OFFSET
1,2
COMMENTS
Perhaps another re-arrangement of natural numbers.
EXAMPLE
5 and 4 are the neighbors of 9 giving the triangular numbers 45 and 36 respectively.
MATHEMATICA
istriang[n_] := With[{x = Floor[Sqrt[2*n]]}, n == x*(x + 1)/2];
nmax = 75;
Clear[a, used, tris];
a[_] = 0; used[_] = 0; tris[_] = 0; a[1] = 1; used[1] = 1;
For[i = 2, i <= nmax, i++, f = a[i-1]; j = 2; While[used[j] == 1 || !istriang[f*j] || tris[f*j] == 1, j++]; a[i] = j; used[j] = 1; tris[f*j] = 1];
Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, May 23 2024, after PARI code *)
PROG
(PARI) istriang(n) = local(x); x = floor(sqrt(2*n)); n == x*(x + 1)/2;
A = vector(75); used = vector(1000); tris = vector(50000); A[1] = 1; used[1] = 1; for (i = 2, 75, f = A[i - 1]; j = 2; while (used[j] || !istriang(f*j) || tris[f*j], j = j + 1); A[i] = j; used[j] = 1; tris[f*j] = 1); print(A)
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Apr 03 2003
EXTENSIONS
More terms from David Wasserman, Jul 26 2004
STATUS
approved