proposed
approved
Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
proposed
approved
editing
proposed
a(1)=1, a(2)=2, for n > 2 if a(n-1) is prime, then a(n) = 2*a(n-1), otherwise a(n) = a(n-1) - 1.
For n >= 3, using Wilson's theorem, a(n) = a(n-1) + (-1)^r*gcd(a(n-1), W), where W = A038507(a(n-1) - 1), and r=1 if gcd(a(n-1), W) = 1 and r=0 otherwise. - Vladimir Shevelev, Aug 07 2009
a[1]:=1: a[2]:=2: for n from 3 to 60 do if isprime(a[n-1])=true then a[n]:=2*a[n-1] else a[n]:=a[n-1]-1 fi od: seq(a[n], n=1..60); - _# _Emeric Deutsch_, Apr 02 2006
approved
editing
proposed
approved
editing
proposed
Comment from _Vladimir Shevelev_, Aug 07 2009: For n>=3, using Wilson's theorem, a(n)=a(n-1)+ (-1)^r*gcd(a(n-1), W), where W = A038507(a(n-1)-1), and r=1 if gcd(a(n-1),W) = 1 and r=0 otherwise. - _Vladimir Shevelev_, Aug 07 2009
approved
editing
Comment from Vladmir _Vladimir Shevelev (shevelev(AT)bgu.ac.il), _, Aug 07 2009: For n>=3, using Wilson's theorem, a(n)=a(n-1)+ (-1)^r*gcd(a(n-1), W), where W = A038507(a(n-1)-1), and r=1 if gcd(a(n-1),W) = 1 and r=0 otherwise.
_Rodolfo Marcelo Kurchan (rkurchan(AT)yahoo.com), _, Mar 26 2006
a[1]:=1: a[2]:=2: for n from 3 to 60 do if isprime(a[n-1])=true then a[n]:=2*a[n-1] else a[n]:=a[n-1]-1 fi od: seq(a[n], n=1..60); - _Emeric Deutsch (deutsch(AT)duke.poly.edu), _, Apr 02 2006
More terms from _Emeric Deutsch (deutsch(AT)duke.poly.edu), _, Apr 02 2006
a(1)=1, a(2)=2, for n>2 if a(n-1) is prime, then a(n)=2a2*a(n-1), otherwise a(n)=a(n-1)-1.
Comment from Vladmir Shevelev (shevelev(AT)bgu.ac.il), Aug 07 2009: For n>=3, using Wilson's theorem, a(n)=a(n-1)+ (-1)^r*gcd(a(n-1), W), where W = A038507(a(n-1)-1), and r=1 if gcd(a(n-1),W) = 1 and r=0 otherwise.
nonn,new
nonn