login
A233334
a(1) = 1; for n > 1, a(n) is the smallest number > a(n-1) such that a(1) + a(2) + ... + a(n) is a composite number.
1
1, 3, 4, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70
OFFSET
1,2
COMMENTS
{a(n)} = {1, 3, 4, 6, 7} union {9, 10, 11, 12, ...} and the sum s(n) = a(1) + a(2) + ... + a(n) is always composite because s(1) = 1, s(2) = 4, s(3) = 8, s(4) = 14 and for n = 5,6,7,... s(n) = (n-2)*(n+9)/2 = 21, 30, 40, 51, ... = A056115(n) for n >= 3.
FORMULA
From Chai Wah Wu, Jan 28 2024: (Start)
a(n) = 2*a(n-1) - a(n-2) for n > 7.
G.f.: x*(-x^6 + x^5 - x^4 + x^3 - x^2 + x + 1)/(x - 1)^2. (End)
EXAMPLE
The third term is 4 because 1+3+4=8 is composite.
MATHEMATICA
p=1; lst={p}; Do[If[!PrimeQ[p+n], AppendTo[lst, n]; p=p+n], {n, 3, 70}]; lst
nxt[{c_, a_}]:=Module[{k=a+1}, While[!CompositeQ[c+k], k++]; {c+k, k}]; NestList[nxt, {1, 1}, 70][[;; , 2]] (* Harvey P. Dale, Dec 05 2023 *)
CROSSREFS
Sequence in context: A154661 A275672 A087753 * A320300 A070762 A061208
KEYWORD
nonn,easy
AUTHOR
Michel Lagneau, Dec 18 2013
STATUS
approved