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.

A093640 Number of divisors of n whose binary representation is contained in that of n.

This page as a plain text file.
%I A093640 #31 Jul 16 2022 07:09:35
%S A093640 1,2,2,3,2,4,2,4,2,4,2,6,2,4,3,5,2,4,2,6,2,4,2,8,2,4,3,6,2,6,2,6,2,4,
%T A093640 2,6,2,4,3,8,2,4,2,6,4,4,2,10,2,4,3,6,2,6,4,8,3,4,2,9,2,4,4,7,2,4,2,6,
%U A093640 2,4,2,8,2,4,4,6,2,6,2,10,2,4,2,6,3,4,3,8,2,8,3,6,3,4,3,12,2,4,3,6,2
%N A093640 Number of divisors of n whose binary representation is contained in that of n.
%H A093640 Reinhard Zumkeller, <a href="/A093640/b093640.txt">Table of n, a(n) for n = 1..10000</a>
%H A093640 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>.
%F A093640 a(n) > 1 for n>1.
%F A093640 a(p) = 2 for primes p.
%F A093640 a(A093641(n)) = A000005(A093641(n)).
%F A093640 a(A093642(n)) < A000005(A093642(n)).
%e A093640 n = 18: divisors of 18: 1 = '1', 2 = '10', 3 = '11', 6 = '110', 9 = '1001' and 18 = '10010': four of them are binary substrings of '10010', therefore a(18) = 4.
%t A093640 a[n_] := DivisorSum[n, 1 &, StringContainsQ @@ IntegerString[{n, #}, 2] &]; Array[a, 100] (* _Amiram Eldar_, Jul 16 2022 *)
%o A093640 (Haskell)
%o A093640 import Data.List (isInfixOf)
%o A093640 a093640 n  = length [d | d <- [1..n], mod n d == 0,
%o A093640                          show (a007088 d) `isInfixOf` show (a007088 n)]
%o A093640 -- _Reinhard Zumkeller_, Jan 22 2012
%o A093640 (Python)
%o A093640 from sympy import divisors
%o A093640 def a(n):
%o A093640     s = bin(n)[2:]
%o A093640     return sum(1 for d in divisors(n, generator=True) if bin(d)[2:] in s)
%o A093640 print([a(n) for n in range(1, 102)]) # _Michael S. Branicky_, Jul 11 2022
%Y A093640 Cf. A000005, A078822, A007088, A093641, A093642.
%K A093640 base,nonn
%O A093640 1,2
%A A093640 _Reinhard Zumkeller_, Apr 07 2004