cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A309399 Number of lucky numbers l between powers of 2, 2^n < l <= 2^(n+1).

This page as a plain text file.
%I A309399 #17 Aug 07 2023 03:55:34
%S A309399 0,1,1,3,3,6,12,21,38,71,123,234,427,791,1477,2774,5222,9849,18659,
%T A309399 35412,67410,128644,245959,471166,904186,1738238,3346542,6452030,
%U A309399 12455921,24076458,46591766,90258683,175029533
%N A309399 Number of lucky numbers l between powers of 2, 2^n < l <= 2^(n+1).
%e A309399 a(0) = 0 because there are no lucky numbers between 1 (2^0) and 2 (2^1).
%e A309399 a(3) = 3 because there are 3 lucky numbers (9, 13, 15) between 8 (2^3) and 16 (2^4).
%o A309399 (SageMath)
%o A309399 def lucky(n):
%o A309399   L=list(range(1, n+1, 2)); j=1
%o A309399   while L[j] <= len(L)-1:
%o A309399     L=[L[i] for i in range(len(L)) if (i+1)%L[j]!=0]
%o A309399     j+=1
%o A309399   return(L)
%o A309399 A000959=lucky(1048576)
%o A309399 def lucky_range(a, b):
%o A309399     lucky = []
%o A309399     for l in A000959:
%o A309399         if l >= b:
%o A309399             return lucky
%o A309399         if l>=a: lucky.append(l)
%o A309399 [ len(lucky_range((2^n)+1,2^(n+1))) for n in range(19)]
%Y A309399 Cf. A000959, A036378.
%K A309399 nonn,more
%O A309399 0,4
%A A309399 _Hauke Löffler_, Jul 28 2019
%E A309399 a(19)-a(30) from _Giovanni Resta_, May 10 2020
%E A309399 a(31)-a(32) from _Kevin P. Thompson_, Nov 22 2021