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

A083524
a(1) = 1, a(n) = a(n-1)*n if n is a prime, a(n) = a(n-1)+ n if n is composite.
3
1, 2, 6, 10, 50, 56, 392, 400, 409, 419, 4609, 4621, 60073, 60087, 60102, 60118, 1022006, 1022024, 19418456, 19418476, 19418497, 19418519, 446625937, 446625961, 446625986, 446626012, 446626039, 446626067, 12952155943
OFFSET
1,2
LINKS
MAPLE
a := proc(n) option remember: if n=1 then RETURN(1) fi: if isprime(n) then RETURN(a(n-1)*n) else RETURN(a(n-1)+n) fi: end: for n from 1 to 50 do printf(`%d, `, a(n)) od: # James A. Sellers, May 19 2003
MATHEMATICA
a083524[n_] := Block[{i, t = Table[1, {n}]},
For[i = 1, i < n,
If[PrimeQ[i], t[[i]] = t[[i - 1]]*i, t[[i]] = t[[i - 1]] + i],
i++]; t]; a083524[29] (* Michael De Vlieger, Dec 24 2014 *)
CROSSREFS
Cf. A083525.
Sequence in context: A067868 A298760 A153803 * A222559 A095107 A115113
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, May 05 2003
EXTENSIONS
More terms from James A. Sellers, May 19 2003
STATUS
approved