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.

A123345 Numbers containing all divisors in their binary representation.

This page as a plain text file.
%I A123345 #17 Jun 05 2022 08:31:15
%S A123345 1,2,3,4,5,6,7,8,10,11,12,13,14,16,17,19,20,22,23,24,26,28,29,31,32,
%T A123345 34,37,38,40,41,43,44,46,47,48,52,53,55,56,58,59,61,62,64,67,68,71,73,
%U A123345 74,76,79,80,82,83,86,88,89,92,94,96,97,101,103,104,106,107,109,112,113,116,118
%N A123345 Numbers containing all divisors in their binary representation.
%H A123345 Reinhard Zumkeller, <a href="/A123345/b123345.txt">Table of n, a(n) for n = 1..10000</a>
%t A123345 q[n_] := AllTrue[Divisors[n], StringContainsQ[IntegerString[n, 2], IntegerString[#, 2]] &]; Select[Range[100], q] (* _Amiram Eldar_, Jun 05 2022 *)
%o A123345 (Haskell)
%o A123345 import Data.List (unfoldr, isInfixOf)
%o A123345 a123345 n = a123345_list !! (n-1)
%o A123345 a123345_list = filter
%o A123345   (\x -> all (`isInfixOf` b x) $ map b $ a027750_row x) [1..] where
%o A123345   b = unfoldr (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2)
%o A123345 -- _Reinhard Zumkeller_, Oct 27 2012
%o A123345 (Python)
%o A123345 from sympy import divisors
%o A123345 def ok(n):
%o A123345     b = bin(n)[2:]
%o A123345     return n and all(bin(d)[2:] in b for d in divisors(n, generator=True))
%o A123345 print([k for k in range(119) if ok(k)]) # _Michael S. Branicky_, Jun 05 2022
%Y A123345 Complement of A093642. Different from A093641.
%Y A123345 Cf. A000040 (subsequence), A027750, A218388.
%K A123345 nonn,base
%O A123345 1,2
%A A123345 _Reinhard Zumkeller_, Oct 12 2006