# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a233334 Showing 1-1 of 1 %I A233334 #64 Jan 29 2024 09:02:03 %S A233334 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, %T A233334 29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51, %U A233334 52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70 %N 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. %C A233334 {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. %H A233334 Harvey P. Dale, Table of n, a(n) for n = 1..1000 %H A233334 Index entries for linear recurrences with constant coefficients, signature (2,-1). %F A233334 From _Chai Wah Wu_, Jan 28 2024: (Start) %F A233334 a(n) = 2*a(n-1) - a(n-2) for n > 7. %F A233334 G.f.: x*(-x^6 + x^5 - x^4 + x^3 - x^2 + x + 1)/(x - 1)^2. (End) %e A233334 The third term is 4 because 1+3+4=8 is composite. %t A233334 p=1; lst={p}; Do[If[!PrimeQ[p+n], AppendTo[lst, n]; p=p+n], {n, 3, 70}]; lst %t A233334 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 *) %Y A233334 Cf. A051935, A056115. %K A233334 nonn,easy %O A233334 1,2 %A A233334 _Michel Lagneau_, Dec 18 2013 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE