A358970 Nonnegative numbers m such that if 2^k appears in the binary expansion of m, then k+1 divides m.
0, 1, 2, 6, 8, 12, 36, 60, 128, 136, 168, 261, 288, 520, 530, 540, 630, 640, 1056, 2052, 2088, 2100, 2184, 2208, 2304, 2340, 2520, 2580, 4134, 8232, 8400, 8820, 9240, 10248, 10920, 16440, 16560, 16920, 16950, 17010, 17040, 17190, 17280, 18480, 18600, 18720
Offset: 1
Examples
60 = 2^5 + 2^4 + 2^3 + 2^2 and 60 is divisible by 5+1, 4+1, 3+1 and 2+1, so 60 belongs to the sequence. 42 = 2^5 + 2^3 + 2^1 and 42 is not divisible by 3+1, so 42 does not belong to the sequence.
Programs
-
Mathematica
Select[Range[20000], Function[n, AllTrue[Position[Reverse@ IntegerDigits[n, 2], 1][[All, 1]], Divisible[n, #] &]]] (* Michael De Vlieger, Dec 12 2022 *)
-
PARI
is(n) = { my (r=n, k); while (r, r-=2^k=valuation(r,2); if (n%(k+1), return (0););); return (1); }
-
Python
def ok(n): return all(n%(k+1) == 0 or not n&(1<
Michael S. Branicky, Dec 07 2022 -
Python
from itertools import count, islice def A358970_gen(startvalue=0): # generator of terms >= startvalue return filter(lambda n:not any(n%i for i,b in enumerate(bin(n)[:1:-1],1) if b=='1'),count(max(startvalue,0))) A358970_list = list(islice(A358970_gen(),20)) # Chai Wah Wu, Dec 12 2022
Comments