%I #12 Mar 04 2020 22:56:58
%S 1,3,9,20,38,64,100,148,209,284,374,480,603,745,908,1093,1301,1533,
%T 1790,2075,2389,2733,3108,3515,3955,4429,4938,5484,6069,6694,7360,
%U 8068,8819,9614,10454,11340,12273,13255,14287,15370,16505,17693,18935,20232
%N a() = 1,3,... [ A037257 ], differences = 2,... [ A037258 ] and 2nd differences [ A037259 ] are disjoint and monotonic; adjoin next free number to 2nd differences unless it would produce a duplicate in which case ignore.
%C 27 and 250 are the first two numbers to be ignored.
%C I discovered this around 1979; Martin Gardner described a version of it in his 1980 article.
%D M. Gardner, Weird Numbers from Titan, Isaac Asimov's Science Fiction Magazine, Vol. 4, No. 5, May 1980, pp. 42ff.
%e After 1 3 9 20 with differences
%e ------ 2 6 11 and 2nd differences
%e ------- 4 5, the next free number is 7 so we get
%e ----- 1 3 9 20 38 ...
%e ------ 2 6 11 18 ...
%e ------- 4 5 7 ....
%t ClearAll[a]; A037257 = {a[0]=1, a[1]=3, a[2]=9}; d1 = Differences[A037257]; d2 = Differences[d1]; ignored = {}; a[n_] := a[n] = (u = Union[A037257, d1, d2, ignored]; m = MapIndexed[List, u]; sel = Select[m, #1[[1]] != #1[[2, 1]] & , 1]; For[nextFree = sel[[1, 2, 1]], True, nextFree++, an2 = nextFree; an = an2 - a[n-2] + 2*a[n-1]; an1 = an - a[n-1]; If[ FreeQ[ ignored, an2] && Length[ Join[ A037257, d1, d2, {an, an1, an2}]] == Length[ Union[ A037257, d1, d2, {an, an1, an2}]], Break[], AppendTo[ ignored, an2]] ]; AppendTo[ A037257, an]; AppendTo[d1, an1]; AppendTo[d2, an2]; an); Table[a[n], {n, 0, 43}] (* _Jean-François Alcover_, Sep 14 2012 *)
%Y Cf. A005228, A030124.
%K nonn,easy,nice
%O 0,2
%A _N. J. A. Sloane_
%E More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000