login
a(0)=1. a(n) = a(n-1)*2, if n is in the sequence. a(n) = a(n-1) + 1 if n is missing from the sequence.
12

%I #12 Mar 06 2024 04:49:13

%S 1,2,4,5,10,20,21,22,23,24,48,49,50,51,52,53,54,55,56,57,114,228,456,

%T 912,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,

%U 1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,3694,7388,14776

%N a(0)=1. a(n) = a(n-1)*2, if n is in the sequence. a(n) = a(n-1) + 1 if n is missing from the sequence.

%t f[s_] := Block[{n = Length@s}, Append[s, If[ MemberQ[s, n], 2s[[ -1]], s[[ -1]] + 1]]]; Nest[f, {1}, 50] (* _Robert G. Wilson v_, May 16 2006 *)

%K easy,nonn

%O 0,2

%A _Leroy Quet_, May 03 2006

%E More terms from _Robert G. Wilson v_, May 16 2006