login
a(2^m + k) = a(k)-th integer among those positive integers not occurring earlier in the sequence, where m >= 0, 1 <= k<= 2^m. a(1) = 1.
4

%I #20 Aug 27 2022 04:06:06

%S 1,2,3,5,4,7,9,12,6,10,13,16,15,20,23,27,8,14,18,22,21,28,31,35,26,34,

%T 39,43,42,49,53,58,11,19,25,32,30,38,44,48,37,47,54,59,57,65,69,74,45,

%U 60,66,72,71,81,85,90,79,91,97,102,101,110,115,121,17,29,36,46,41,55,62

%N a(2^m + k) = a(k)-th integer among those positive integers not occurring earlier in the sequence, where m >= 0, 1 <= k<= 2^m. a(1) = 1.

%C Sequence is a permutation of the positive integers.

%H Ivan Neretin, <a href="/A119474/b119474.txt">Table of n, a(n) for n = 1..8192</a>

%e 8 = 2^2 +4. So since k = 4, we want the a(4)th = 5th positive integer from the sequence 6,8,10,11,12,13,..., i.e., from the sequence of positive integers not occurring among the first 7 terms of {a(k)}. So a(8) = 12.

%t a = {1}; Do[AppendTo[a, Complement[Range[Max[a] + (d = a[[i - 2^Floor[Log2[i - 1]]]])], a][[d]]], {i, 2, 71}]; a (* _Ivan Neretin_, May 03 2015 *)

%Y Cf. A101267, A119475.

%K easy,nonn,look

%O 1,2

%A _Leroy Quet_, May 22 2006

%E More terms from _Joshua Zucker_, Jul 04 2006