login

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”).

A131199
a(0)=2. For n>=1, a(n) = a(n-1) + n if a(n-1) is composite; a(n) = a(n-1)*n if a(n-1) is prime.
1
2, 2, 4, 7, 28, 33, 39, 46, 54, 63, 73, 803, 815, 828, 842, 857, 13712, 13729, 247122, 247141, 4942820, 4942841, 4942863, 4942886, 4942910, 4942935, 4942961, 4942988, 4943016, 4943045, 4943075, 4943106, 4943138, 4943171, 4943205, 4943240
OFFSET
0,1
LINKS
MAPLE
a[0]:=2: for n to 30 do if isprime(a[n-1])=false then a[n]:=a[n-1]+n else a[n]:=a[n-1]*n end if end do: seq(a[n], n=0..30); # Emeric Deutsch, Oct 24 2007
A131199 := proc(n) option remember ; if n = 0 then 2 ; else if isprime(A131199(n-1)) then n*A131199(n-1) ; else n+A131199(n-1) ; fi ; fi ; end: seq(A131199(n), n=0..80) ; # R. J. Mathar, Oct 30 2007
MATHEMATICA
Transpose[NestList[If[PrimeQ[Last[#]], {First[#]+1, (First[#]+1)Last[#]}, {First[#]+1, Total[#]+1}]&, {0, 2}, 40]][[2]] (* Harvey P. Dale, Jun 02 2012 *)
CROSSREFS
Cf. A083524.
Sequence in context: A238184 A340333 A065844 * A112059 A093094 A045777
KEYWORD
nonn
AUTHOR
Leroy Quet, Oct 21 2007
EXTENSIONS
More terms from Emeric Deutsch and R. J. Mathar, Oct 24 2007
STATUS
approved