OFFSET
1,2
COMMENTS
A variation on lucky numbers A000959: To get these, remove at the n-th step every a(n)-th remaining number, except for n = 1, where at the 1st step the even numbers are removed (as here).
EXAMPLE
Start with A = [1, 2, 3, 4, ...]. For n = 1 (the 1st step), we have a(1)+1 = 1+1 = 2, so we remove every 2nd number. Then only the list A' of odd numbers remains.
For n = 2 (the 2nd step), we have a(2)+1 = 3+1 = 4, so we remove every 4th number from the list A', it remains A'' = [1,3,5, 9,11,13, 17,19,21, 25,...].
For n = 3 (the 3rd step), we have a(3) + 1 = 5 + 1 = 6, so we remove every 6th number from the above list A'' of remaining numbers. It remains A''' = [1,3,5,9,11, 17,19,21,25,27, 31,...].
For n = 4 (the 4th step), we have a(4)+1 = 9+1 = 10, and we remove every 10th number from the list A'''. And so on.
a(4) = 9, not 7 because 7 was removed during the 2nd iteration with the rest of the (a(2)+1)th numbers (15, 23, 31, 39, etc.) in the sequence remaining after the 1st iteration.
PROG
(PARI) A111039_upto(N, A=[1..N])={for(i=1, N, (i>#A||A[i]>#A)&& break; my(t=A[i]+1); A=vecextract(A, 2^#A-1-2^(#A\t*t)\(2^t-1)<<A[i])); A} \\ M. F. Hasler, Jan 29 2020
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Brent Lehman, Oct 05 2005
EXTENSIONS
Edited by M. F. Hasler, Jan 29 2020
STATUS
approved