login
A213183
Initialize a(1)=R=1. Repeat: copy the last R preceding terms to current position; increment R; do twice: append the least integer that has not appeared in the sequence yet.
1
1, 1, 2, 3, 2, 3, 4, 5, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 10, 11, 6, 7, 8, 9, 10, 11, 12, 13, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 11, 12
OFFSET
1,3
COMMENTS
Every positive integer k occurs floor((k+3)/2) times: 1 and 2 occur twice, 3 and 4 thrice, 5 and 6 four times, and so on.
EXAMPLE
a(1) = 1 -- initial value
a(2) = 1 -- copied one last term
a(3)=2, a(4)=3 -- appended two terms
a(5)=2, a(6)=3 -- copied two last terms
a(7)=4, a(8)=5 -- appended two terms
a(9)=3, a(10)=4, a(11)=5 -- copied three last terms
a(12)=6, a(13)=7 -- appended two terms
a(14)=4, a(15)=5, a(16)=6, a(17)=7 -- copied four last terms
a(18)=8, a(19)=9 -- appended two terms, and so on.
Comments from N. J. A. Sloane, Apr 28 2020, following a suggestion from Paul Curtz: (Start)
With an initial -1, 0, this may also be regarded as a triangle read by rows:
-1;
0, 1;
1, 2, 3;
2, 3, 4, 5;
3, 4, 5, 6, 7;
4, 5, 6, 7, 8, 9;
5, 6, 7, 8, 9, 10, 11;
6, 7, 8, 9, 10, 11, 12, 13;
...
or as an array read by upward antidiagonals:
-1, 1, 3, 5, 7, 9, 11, ...
0, 2, 4, 6, 8, 10, ...
1, 3, 5, 7, 9, ...
2, 4, 6, 8, ...
3, 5, 7, ...
4, 6, ...
5, ...
...
(End)
PROG
(Python)
a = [1]*992
R = 1
i = 2
while i<900:
for t in range(R):
a[i] = a[i-R]
i += 1
R += 1
a[i] = a[i-1] + 1
i += 1
a[i] = a[i-1] + 1
i += 1
for i in range(1, 99):
print(a[i], end=', ')
CROSSREFS
If we prefix this with -1, 0, and then add 1 to every term, we get A051162.
Sequence in context: A324390 A260112 A361838 * A125929 A309236 A071933
KEYWORD
nonn,easy,tabf
AUTHOR
Alex Ratushnyak, Mar 05 2013
STATUS
approved