A309399 Number of lucky numbers l between powers of 2, 2^n < l <= 2^(n+1).
0, 1, 1, 3, 3, 6, 12, 21, 38, 71, 123, 234, 427, 791, 1477, 2774, 5222, 9849, 18659, 35412, 67410, 128644, 245959, 471166, 904186, 1738238, 3346542, 6452030, 12455921, 24076458, 46591766, 90258683, 175029533
Offset: 0
Examples
a(0) = 0 because there are no lucky numbers between 1 (2^0) and 2 (2^1). a(3) = 3 because there are 3 lucky numbers (9, 13, 15) between 8 (2^3) and 16 (2^4).
Programs
-
SageMath
def lucky(n): L=list(range(1, n+1, 2)); j=1 while L[j] <= len(L)-1: L=[L[i] for i in range(len(L)) if (i+1)%L[j]!=0] j+=1 return(L) A000959=lucky(1048576) def lucky_range(a, b): lucky = [] for l in A000959: if l >= b: return lucky if l>=a: lucky.append(l) [ len(lucky_range((2^n)+1,2^(n+1))) for n in range(19)]
Extensions
a(19)-a(30) from Giovanni Resta, May 10 2020
a(31)-a(32) from Kevin P. Thompson, Nov 22 2021