%I #18 Sep 16 2024 04:06:13
%S 1,4,6,7,10,11,12,16,18,19,20,21,26,28,30,31,34,35,36,37,38,44,46,48,
%T 50,51,54,55,58,59,60,64,66,67,68,69,70,71,78,80,82,84,86,87,90,91,94,
%U 95,98,99,100,104,106,107,108,112,114,115,116,117,122,124,126,127,130,131
%N a(1)=1. For n>=2, a(n) = n + (largest integer which is <= n and is missing from the earlier terms of the sequence).
%e The largest integer which is <= 12 and does not occur among the first 11 terms of the sequence is 9. So a(12) = 12 + 9 = 21.
%t f[l_List] := Block[{n = Length[l] + 1, k = n},While[MemberQ[l, k], k-- ];Append[l, n + k]];Nest[f, {1}, 70] (* _Ray Chandler_, Sep 30 2006 *)
%o (PARI) {my(m=66, w=vector(2*m), a); print1(a=1,", "); for(n=2,m,my(k=n);while(w[k],k--); print1(a=n+k,", "); w[a]=1)} \\ _Klaus Brockhaus_, Oct 05 2006
%Y Cf. A123679.
%K nonn
%O 1,2
%A _Leroy Quet_, Sep 27 2006
%E Extended by _Ray Chandler_ and _Klaus Brockhaus_, Sep 30 2006