A175381 A positive integer k is included if all positive integers that, when written in binary, occur as substrings in binary k divide k.
1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24, 32, 36, 40, 48, 64, 72, 80, 96, 128, 136, 144, 160, 192, 256, 272, 288, 320, 384, 512, 528, 544, 576, 640, 768, 1024, 1056, 1088, 1152, 1280, 1536, 2048, 2080, 2112, 2176, 2304, 2560, 3072, 4096, 4160, 4224, 4352, 4608
Offset: 1
Examples
20 in binary is 10100. The positive integers that, when written in binary, occur as substrings in 10100 are: 1 (1 in binary), 2 (10 in binary), 4 (100 in binary), 5 (101 in binary), 10 (1010 in binary), and 20 (10100 in binary.) Since 1, 2, 4, 5, 10, and 20 each are a divisor of 20, then 20 is in this sequence.
Links
- Ivan Neretin, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A175382.
Programs
-
Mathematica
mx = 12; Union[2^Range[0, mx], Flatten@Table[2^n + 2^k, {n, 0, mx}, {k, Quotient[n, 2], n - 1}]] (* Ivan Neretin, Nov 24 2016 *)
-
Python
def ok(n): s = bin(n)[2:] subs = (s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1) if s[i]!='0') return n and all(n%v == 0 for ss in subs if (v:=int(ss, 2)) > 0) print([k for k in range(5000) if ok(k)]) # Michael S. Branicky, May 09 2025
Extensions
Spelling corrected by Jason G. Wurtzel, Sep 04 2010
a(11)-a(53) from Lars Blomberg, May 05 2011
Comments