%I #14 Jun 30 2023 15:39:36
%S 4,2,3,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,
%T 27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,
%U 50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72
%N Rearrangement of natural numbers so that every partial sum is composite.
%C a(n) = n for n > 4.
%C Except for the integers 1 & 4 which are interchanged, the sequence is in order. Proof: Except for the first three triangular numbers (A000217), {0, 1, 3}, they are all composite. - _Robert G. Wilson v_, Jun 27 2010
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (2, -1).
%F G.f.: 3 - 3*x^3 + 1/(x-1)^2. - _Sergei N. Gladkovskii_, Oct 16 2012
%e Partial sums are 4,6,9,10,15,21,...
%t f[s_List] := Block[{k = 0, t = Plus @@ s}, While[MemberQ[s, k] || PrimeQ[t + k] || t + k < 2, k++ ]; Append[s, k]]; Rest@ Nest[f, {0}, 72] (* _Robert G. Wilson v_, Jun 27 2010 *)
%K easy,nonn
%O 1,1
%A _Amarnath Murthy_, Jun 23 2010
%E a(40)-a(72) from _Robert G. Wilson v_, Jun 27 2010
|