cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A051912 a(n) is the smallest integer such that the sum of any three ordered terms a(k), k <= n, is unique.

This page as a plain text file.
%I A051912 #36 Mar 01 2024 14:15:45
%S A051912 0,1,4,13,32,71,124,218,375,572,744,1208,1556,2441,3097,4047,5297,
%T A051912 6703,7838,10986,12331,15464,19143,24545,28973,34405,37768,45863,
%U A051912 50876,61371,68302,77917,88544,101916,122031,131624,148574,171236,197814
%N A051912 a(n) is the smallest integer such that the sum of any three ordered terms a(k), k <= n, is unique.
%H A051912 Chai Wah Wu, <a href="/A051912/b051912.txt">Table of n, a(n) for n = 0..225</a> (terms 0..100 from Robert Israel)
%e A051912 Three terms chosen from {0,1,4} can be 0+0+0; 0+0+1; 0+1+1; 1+1+1; 0+0+4; 0+1+4; 1+1+4; 0+4+4; 1+4+4; 4+4+4 are all distinct (3*4*5/6 = 10 terms), so a(2) = 4 is the next integer of the sequence after 0 and 1.
%p A051912 A[0]:= 0: S:= {0}: S2:= {0}: S3:= {0}:
%p A051912 for i from 1 to 40 do
%p A051912   for x from A[i-1] do
%p A051912     if (map(t -> t+x,S2) intersect S3 = {}) and (map(t -> t+2*x, S) intersect S3 = {}) then
%p A051912      A[i]:= x;
%p A051912      S3:= S3 union map(t -> t+x,S2) union map(t -> t+2*x, S) union {3*x};
%p A051912      S2:= S2 union map(t -> t+x, S) union {2*x};
%p A051912      S:= S union {x};
%p A051912      break
%p A051912     fi
%p A051912   od
%p A051912 od:
%p A051912 seq(A[i],i=0..40); # _Robert Israel_, Jul 01 2019
%t A051912 a[0] = 0; a[1] = 1; a[n_] := a[n] = For[A0 = Array[a, n, 0]; an = a[n-1] + 1, True, an++, A1 = Append[A0, an]; A2 = Flatten[Table[A1[[{i, j, k}]], {i, 1, n+1}, {j, i, n+1}, {k, j, n+1}], 2]; A3 = Sort[Total /@ A2]; If[Length[A3] == Length[Union[A3]], Return[an]]]; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 0, 38}] (* _Jean-François Alcover_, Nov 24 2016 *)
%o A051912 (Python)
%o A051912 from itertools import count, islice
%o A051912 def A051912_gen(): # generator of terms
%o A051912     aset1, aset2, aset3, alist = set(), set(), set(), []
%o A051912     for k in count(0):
%o A051912         bset2, bset3 = {k<<1}, {3*k}
%o A051912         if 3*k not in aset3:
%o A051912             for d in aset1:
%o A051912                 if (m:=d+(k<<1)) in aset3:
%o A051912                     break
%o A051912                 bset2.add(d+k)
%o A051912                 bset3.add(m)
%o A051912             else:
%o A051912                 for d in aset2:
%o A051912                     if (m:=d+k) in aset3:
%o A051912                         break
%o A051912                     bset3.add(m)
%o A051912                 else:
%o A051912                     yield k
%o A051912                     alist.append(k)
%o A051912                     aset1.add(k)
%o A051912                     aset2 |= bset2
%o A051912                     aset3 |= bset3
%o A051912 A051912_list = list(islice(A051912_gen(),20)) # _Chai Wah Wu_, Sep 01 2023
%Y A051912 Row 3 of A365515.
%Y A051912 Cf. A025582, A036241, A062065.
%K A051912 nonn,nice
%O A051912 0,3
%A A051912 _Wouter Meeussen_, Dec 17 1999
%E A051912 More terms from _Naohiro Nomoto_, Jul 22 2001