OFFSET
1,2
COMMENTS
Note that a(22) = -163 is the last prime generated by this sequence. All subsequent terms are composite and equal (16-n)(n+17)/2.
FORMULA
a(n) = -(n-16)(n+17)/2 for n > 22
EXAMPLE
a(1) = 1, a(2) = 1+2 =3 is a prime hence a(3) = 3 +3 = 6 which is composite hence a(4) = 6-4 = 2 etc.
MATHEMATICA
a=3; Join[{1, 3}, Table[If[PrimeQ[a], a=a+n, a=a-n], {n, 3, 60}]]
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Amarnath Murthy, Aug 30 2002
EXTENSIONS
Corrected and extended by Jason Earls, Sep 01 2002
Corrected by T. D. Noe, Oct 04 2004
STATUS
approved