login
Earliest sequence with a(a(n)) = n*(n+1)/2 (Triangular numbers).
2

%I #18 Jul 29 2022 22:02:17

%S 0,1,4,10,3,7,55,15,9,36,6,12,66,14,91,28,17,136,19,171,22,1540,210,

%T 24,276,26,325,29,120,378,31,465,33,528,35,595,45,38,703,40,780,42,

%U 861,44,946,666,47,1081,49,1176,51,1275,53,1378,56,21,1485,58,1653

%N Earliest sequence with a(a(n)) = n*(n+1)/2 (Triangular numbers).

%H <a href="/index/Aa#aan">Index entries for sequences of the a(a(n)) = 2n family</a>

%e a(a(3)) = a(10) = 6 = 3*4/2.

%t nmax = 58; amax = 2000; tri[n_] := n*(n+1)/2; triQ[n_] := triQ[n] = Resolve[ Exists[ k, Reduce[ k > 0 && n == tri[k], k, Integers] ] ]; t = {{0, a[0] = 0}, {1, a[1] = 1}, {2, a[2]}}; While[ !FreeQ[t, a], t = Table[ {n, a[n]}, {n, 0, nmax}]; n = Select[t, !IntegerQ[#[[2]]]& , 1][[1, 1]]; t2 = Union[ Flatten[ Append[ Select[ t, IntegerQ[ #[[2]] ] & ], n] ] ]; an = If[ n == 2, 4, Select[ Complement[ Range[ Max[t2] ], t2], !triQ[#]&, 1][[1]]]; a[n] = an; While[ an < amax, an = a[n = an] = tri[n] ] ]; A054048 = Table[ a[n], {n, 0, nmax}] (* _Jean-François Alcover_, Jan 05 2012 *)

%Y Cf. A000217.

%K base,nice,nonn

%O 0,3

%A _Henry Bottomley_, Apr 28 2000