

A249558


a(a(n)) is a triangular number.


0



1, 3, 6, 2, 7, 10, 15, 9, 21, 28, 12, 36, 14, 45, 55, 17, 66, 19, 78, 22, 91, 105, 24, 120, 26, 136, 29, 153, 171, 31, 190, 33, 210, 35, 231, 253, 38, 276, 40, 300, 42, 325, 44, 351, 378, 47, 406, 49, 435, 51, 465, 53, 496, 56, 528, 561
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

To build T: always use the smallest integer not yet present in T and not leading to a contradiction.
All triangular numbers appear in their natural order.
Density of T: it appears that more than 50% of the terms are triangular.
Arie Groeneveld computed a million terms in less than 1.5 seconds using the language J.


REFERENCES

Eric Angelini, Postings to Sequence Fans Mailing List, Mar 02 2011 and Mar 03 2011.


LINKS

Table of n, a(n) for n=1..56.


EXAMPLE

T = 1,... meaning that the first term of T is a triangular number (true)
The next term can't be 2 as '2' would mean that the second term of T is a triangular term  which is false, 2 is not a triangular number  see A000217
Then:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,
We have to put a triangular number 't' in third position:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,t,
Thus:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,
Thus:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,* * t
Now we need to replace the first star with "the smallest integer not yet present in T and not leading to a contradiction":
Thus:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,* t
Next star is replaced by "the smallest etc." which can't be 4, 5 or 6  thus 7 (the 4th term of T is not a triangular number, the 5th neither  as it would be '5'  and '6' is already in T):
Thus:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,t
and:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,t t
We replace the next two 't' with two triangular numbers:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,10,15,
and mark accordingly the 10th and 15th term of T with 't':
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,10,15, t t
The next 'hole' we have to fill in T is the 8th; we put '9':
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,10,15,9, t t
and we add accordingly a 't' in 9th position:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,10,15,9,t, t t
Now two more triangular numbers:
n : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
T = 1,3,6,2,7,10,15,9,21,28, t
... etc.


PROG

(J)
arr249558 =: monad define
n=. # (, 8+{:)^:(y>+/)^:_[ 6 15
ti=. (#~y>])+/\ 0 1 1 3 1 2, ; , &2 2&.>^:(<n) 1 2 2; 3$<1 2 2 2
tn=. (#ti){.+/\ 1+i.y
ni=. (#~y>])+/\ 3 1 3, ; , & 2 2&.>^:(<n) 3 2; 3$<3 2 2
nn=. (# ni){.+/\ 2 5 2 3 2 3 2, ; , &2 2&.>^:(<n)3 2 2; 3$<3 2 2 2
(tn, nn) /: ti, ni
)
Arie Groeneveld, Dec 02 2014


CROSSREFS

Cf. A000217.
Sequence in context: A186706 A169749 A169750 * A072007 A078783 A273465
Adjacent sequences: A249555 A249556 A249557 * A249559 A249560 A249561


KEYWORD

nonn


AUTHOR

N. J. A. Sloane, Nov 01 2014


STATUS

approved



