login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Nonnegative numbers m such that if 2^k appears in the binary expansion of m, then k+1 divides m.
0

%I #15 Dec 12 2022 15:00:27

%S 0,1,2,6,8,12,36,60,128,136,168,261,288,520,530,540,630,640,1056,2052,

%T 2088,2100,2184,2208,2304,2340,2520,2580,4134,8232,8400,8820,9240,

%U 10248,10920,16440,16560,16920,16950,17010,17040,17190,17280,18480,18600,18720

%N Nonnegative numbers m such that if 2^k appears in the binary expansion of m, then k+1 divides m.

%C In other words, numbers whose binary expansion encodes a subset of their divisors.

%C Also numbers m divisible by A271410(m).

%C This sequence is infinite as it contains A058891.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%e 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.

%e 42 = 2^5 + 2^3 + 2^1 and 42 is not divisible by 3+1, so 42 does not belong to the sequence.

%t Select[Range[20000], Function[n, AllTrue[Position[Reverse@ IntegerDigits[n, 2], 1][[All, 1]], Divisible[n, #] &]]] (* _Michael De Vlieger_, Dec 12 2022 *)

%o (PARI) is(n) = { my (r=n, k); while (r, r-=2^k=valuation(r,2); if (n%(k+1), return (0););); return (1); }

%o (Python)

%o def ok(n): return all(n%(k+1) == 0 or not n&(1<<k) for k in range(n.bit_length()))

%o print([m for m in range(20000) if ok(m)]) # _Michael S. Branicky_, Dec 07 2022

%o (Python)

%o from itertools import count, islice

%o def A358970_gen(startvalue=0): # generator of terms >= startvalue

%o 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)))

%o A358970_list = list(islice(A358970_gen(),20)) # _Chai Wah Wu_, Dec 12 2022

%Y Cf. A058891, A271410, A320673.

%K nonn,base,easy

%O 1,3

%A _Rémy Sigrist_, Dec 07 2022