Request for more Python programs
N. J. A. Sloane
njas at research.att.com
Mon Jan 1 23:12:41 CET 2007
From: "Peter Pein" <petsie at dordos.net>
> Or simply a:=n->2*sin(Pi*(n+1)/3)/sqrt(3)
>
> (if we are talking about A010892, not A010982)
Since it is periodic, one of the following is, probably, the simplest
in Maple, I didn't test their efficiency,
A010892:=n->[1,1,0,-1,-1,0][irem(n,6)+1];
A010892:=n->Array(0..5,[1,1,0,-1,-1,0])[irem(n,6)];
A010892:=n->table([0=1,1=1,2=0,3=-1,4=-1,5=0])[irem(n,6)];
Alec
More information about the SeqFan
mailing list