A037257 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.
1, 3, 9, 20, 38, 64, 100, 148, 209, 284, 374, 480, 603, 745, 908, 1093, 1301, 1533, 1790, 2075, 2389, 2733, 3108, 3515, 3955, 4429, 4938, 5484, 6069, 6694, 7360, 8068, 8819, 9614, 10454, 11340, 12273, 13255, 14287, 15370, 16505, 17693, 18935, 20232
Offset: 0
Examples
After 1 3 9 20 with differences ------ 2 6 11 and 2nd differences ------- 4 5, the next free number is 7 so we get ----- 1 3 9 20 38 ... ------ 2 6 11 18 ... ------- 4 5 7 ....
References
- M. Gardner, Weird Numbers from Titan, Isaac Asimov's Science Fiction Magazine, Vol. 4, No. 5, May 1980, pp. 42ff.
Programs
-
Mathematica
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 *)
Extensions
More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000
Comments