Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #26 Nov 28 2024 21:29:50
%S 1,3,6,8,11,13,16,18,21,23,35,40,45,53,58,63,66,68,73,86,96,110,120,
%T 125,128,131,133,138,143,148,151,171,178,181,183,188,193,198,205,211,
%U 216,239,244,250,256,258,261,263,268,273
%N a(1) = 1 and a(n) is the smallest number greater than a(n-1) with no square difference with any preceding term.
%C The first 11 terms are identical to those of A210570.
%H Jean-François Alcover, <a href="/A224839/b224839.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) >= A210570(n) by definition of the latter. - _Charles R Greathouse IV_, Nov 28 2024
%p N:= 1000: # to get all terms <= N
%p V:= Vector(N):
%p Res:= NULL:
%p for m from 1 to N do
%p if V[m] = 0 then
%p V[m]:= 1;
%p Res:= Res, m;
%p for k from 1 to floor(sqrt(N-m)) do V[m+k^2]:= 1 od:
%p fi
%p od:
%p Res; # _Robert Israel_, Nov 30 2016
%t a[1] = 1; a[n_] := a[n] = For[k = a[n-1]+1, True, k++, If[FreeQ[k - Array[a, n-1], d_ /; IntegerQ[Sqrt[d]]], Return[k]]]; Table[a[n], {n, 1, 40}]
%o (Haskell)
%o a224839 n = a224839_list !! (n-1)
%o a224839_list = f [1..] [] where
%o f (x:xs) ys = if all ((== 0) . a010052) $ map (x -) ys
%o then x : f xs (x:ys) else f xs ys
%o -- _Reinhard Zumkeller_, May 02 2014
%Y Cf. A210570.
%Y Cf. A010052.
%K nonn
%O 1,2
%A _Jean-François Alcover_, Sep 18 2013