other programs %o, was Re: Extending silly sequences

Jaap Spies j.spies at hccnet.nl
Sat May 13 00:16:30 CEST 2006


N. J. A. Sloane wrote:
> Jaap, an attached text file is OK, certainly
> 
> or we can do what we have been doing with Python:  Example:
> 
> %o A048927 (Python: replace leading dots by blanks):
> %o A048927 def ways (n, left=5, last=1):
> %o A048927 . a=last; a3=a*a*a; c=0
> %o A048927 . while a3<=n-left+1:
> %o A048927 ... if left>1:
> %o A048927 ..... c=c+ways(n-a3, left-1, a)
> %o A048927 .... elif a3==n:
> %o A048927 ..... c=c+1
> etc
> 

I prefer a link to an attached text file, copy and paste will be
a lot easier! Placing dots is error prone as you can see in the example!

Thanks.

Jaap





More information about the SeqFan mailing list