[seqfan] Re: Re Nice variant on A030067

jean-paul allouche allouche at math.jussieu.fr
Sun Jan 12 18:53:35 CET 2014


Mathematica or Sage? Any hint?
(I know the classical "vi" vs "emacs" and the like :-))
jean-paul


Le 12/01/14 18:46, Neil Sloane a écrit :
> Maximilian, That is very helpful, thanks - I replaced the Maple code.
> Maple has done this repeatedly over the years - changing fundamental
> commands
> so that old programs no longer work. Guess it is time to
> switch to Mathematica.
>
>
> On Sun, Jan 12, 2014 at 11:48 AM, M. F. Hasler <oeis at hasler.fr> wrote:
>
>> If I may:
>>
>> The RETURN() or return() or RETURN or return functions/statements are
>> useless and error-producing since the syntax changes in each version of
>> Maple. (I exaggerate, of course.) But its true that they are useless
>> (unless you really have to "bail out" from inside a multiply nested loop or
>> similar construct) and it's not only simpler, shorter, but plain better to
>> just remove them, so it should read:
>>
>>    f:=proc(n) option remember; local t1;
>>>    if n = 1 then 1
>>>    elif n mod 2 = 0 then f(n/2)
>>>    else t1:= f(n-2)-f((n-1)/2);
>>>    if t1 > 0 then t1 else f(n-2)+f((n-1)/2) fi fi end;
>>
>> (unless I'm wrong)
>> See also http://www.maplesoft.com/support/help/Maple/view.aspx?path=return:
>>
>>>>
>> One common form of return from a procedure invocation occurs when execution
>> ``falls through'' the end of the statement sequence which makes up the
>> procedure body, in which case the value of the procedure invocation is the
>> value of the last statement executed.
>>>>
>> The return statement supersedes the RETURN function, which still exists for
>> backward compatibility. However, use of the RETURN procedure is strongly
>> discouraged.
>>
>>
>> Maximilian
>>
>> _______________________________________________
>>
>> Seqfan Mailing list - http://list.seqfan.eu/
>>
>
>




More information about the SeqFan mailing list