editing
approved
editing
approved
Earliest sequence with a(a(n)) = n*(n+1)/2 (Triangular numbers).
a(a(3)) = a(10) = 6 = 3*4/2.
approved
editing
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}] (* From _Jean-François Alcover, _, Jan 05 2012 *)
_Henry Bottomley (se16(AT)btinternet.com), _, Apr 28 2000
proposed
approved
editing
proposed
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] ] ]; triQ[0] = 0; 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}] (* From Jean-François Alcover, Jan 05 2012 *)
approved
editing
proposed
approved
editing
proposed
nmax = 60; a[0]=0; a[1]=1; a0[2]=4; a0[5]=7; a0[20]=22; a0[27]=29; a0[54]=5658; a0[n_] :amax = n+12000; ftri[n_, 1] := f[n, 1] = {n, a[n] = a0[n], n*(n+1)/2}; ftriQ[n_, k_] := ftriQ[n, ] = Resolve[ Exists[ k] = With[{m = f, Reduce[ k > 0 && n, == tri[k], k-, Integers] ] ]; triQ[0] = 0; t = {{0, a[0] = 0}, {1, a[1][ = 1}, {2, a[2]]}, {m , }; While[ !FreeQ[t, a[m] , t = fTable[ {n, a[n, k-]}, {n, 0, nmax}]; n = Select[t, !IntegerQ[#[[2]]]& , 1][[3]], m*(m+1)/2}]; Do[ k=, 1]]; Ift2 = 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[ fan < amax, an = a[n, k++][[1]] < = nmax]an], { = tri[n, 2, nmax}] ] ]; A054048 = Table[ a[n] , , {n, 0, nmax}] (* From Jean-François Alcover, Dec 30 2011 Jan 05 2012 *)
approved
editing