%I #29 May 22 2021 04:30:12
%S 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,
%T 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,
%U 13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,18,19,20,21,11,12
%N 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.
%C 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.
%e a(1) = 1 -- initial value
%e a(2) = 1 -- copied one last term
%e a(3)=2, a(4)=3 -- appended two terms
%e a(5)=2, a(6)=3 -- copied two last terms
%e a(7)=4, a(8)=5 -- appended two terms
%e a(9)=3, a(10)=4, a(11)=5 -- copied three last terms
%e a(12)=6, a(13)=7 -- appended two terms
%e a(14)=4, a(15)=5, a(16)=6, a(17)=7 -- copied four last terms
%e a(18)=8, a(19)=9 -- appended two terms, and so on.
%e Comments from _N. J. A. Sloane_, Apr 28 2020, following a suggestion from _Paul Curtz_: (Start)
%e With an initial -1, 0, this may also be regarded as a triangle read by rows:
%e -1;
%e 0, 1;
%e 1, 2, 3;
%e 2, 3, 4, 5;
%e 3, 4, 5, 6, 7;
%e 4, 5, 6, 7, 8, 9;
%e 5, 6, 7, 8, 9, 10, 11;
%e 6, 7, 8, 9, 10, 11, 12, 13;
%e ...
%e or as an array read by upward antidiagonals:
%e -1, 1, 3, 5, 7, 9, 11, ...
%e 0, 2, 4, 6, 8, 10, ...
%e 1, 3, 5, 7, 9, ...
%e 2, 4, 6, 8, ...
%e 3, 5, 7, ...
%e 4, 6, ...
%e 5, ...
%e ...
%e (End)
%o (Python)
%o a = [1]*992
%o R = 1
%o i = 2
%o while i<900:
%o for t in range(R):
%o a[i] = a[i-R]
%o i += 1
%o R += 1
%o a[i] = a[i-1] + 1
%o i += 1
%o a[i] = a[i-1] + 1
%o i += 1
%o for i in range(1,99):
%o print(a[i], end=',')
%Y If we prefix this with -1, 0, and then add 1 to every term, we get A051162.
%K nonn,easy,tabf
%O 1,3
%A _Alex Ratushnyak_, Mar 05 2013
|