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.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,-1).
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
KEYWORD
nonn,easy
AUTHOR
Michel Lagneau, Dec 18 2013
STATUS
approved