login
A120760
a(1) = a(2) = 1. a(n) = a(n-1) + (largest nonprime {1 or composite} among the first n-2 terms of the sequence).
2
1, 1, 2, 3, 4, 5, 9, 13, 22, 31, 53, 75, 97, 172, 247, 419, 666, 913, 1579, 2492, 3405, 5897, 9302, 12707, 22009, 34716, 56725, 91441, 148166, 239607, 387773, 627380, 1015153, 1642533, 2657686, 4300219, 6957905, 11258124, 18216029, 29474153
OFFSET
1,3
LINKS
EXAMPLE
Among the first 8 terms of the sequence, 9 is the largest nonprime. So a(10) = a(9) + 9 = 22 + 9 = 31.
MAPLE
isA018252 := proc(n) if n = 1 or not isprime(n) then true ; else false ; fi ; end: A120760 := proc(nmin) local a, lnpr, k; a := [1, 1, 2] ; while nops(a) < nmin do lnpr :=0 ; for k in [op(1..nops(a)-1, a)] do if isA018252(k) then lnpr := max(lnpr, k) ; fi ; od: a := [op(a), a[ -1]+lnpr] ; od: RETURN(a) ; end: A120760(80) ; # R. J. Mathar, Sep 18 2007
MATHEMATICA
s={1, 1}; Do[AppendTo[s, s[[-1]]+Max[Select[Drop[s, -1], !PrimeQ[#]&]]], {n, 3, 40}]; s (* James C. McMahon, Oct 09 2024 *)
CROSSREFS
Cf. A120761.
Sequence in context: A253181 A107365 A026484 * A245449 A337647 A346600
KEYWORD
nonn
AUTHOR
Leroy Quet, Jul 03 2006
EXTENSIONS
More terms from R. J. Mathar, Sep 18 2007
STATUS
approved