# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a054048 Showing 1-1 of 1 %I A054048 #18 Jul 29 2022 22:02:17 %S A054048 0,1,4,10,3,7,55,15,9,36,6,12,66,14,91,28,17,136,19,171,22,1540,210, %T A054048 24,276,26,325,29,120,378,31,465,33,528,35,595,45,38,703,40,780,42, %U A054048 861,44,946,666,47,1081,49,1176,51,1275,53,1378,56,21,1485,58,1653 %N A054048 Earliest sequence with a(a(n)) = n*(n+1)/2 (Triangular numbers). %H A054048 Index entries for sequences of the a(a(n)) = 2n family %e A054048 a(a(3)) = a(10) = 6 = 3*4/2. %t A054048 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 A054048 Cf. A000217. %K A054048 base,nice,nonn %O A054048 0,3 %A A054048 _Henry Bottomley_, Apr 28 2000 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE