login
Number of divisors of n that are also suffixes of n in binary representation.
10

%I #23 Jun 21 2023 06:47:23

%S 1,1,2,1,2,2,2,1,2,2,2,2,2,2,3,1,2,2,2,2,2,2,2,2,2,2,3,2,2,3,2,1,2,2,

%T 2,2,2,2,3,2,2,2,2,2,3,2,2,2,2,2,3,2,2,3,2,2,2,2,2,3,2,2,4,1,2,2,2,2,

%U 2,2,2,2,2,2,3,2,2,3,2,2,2,2,2,2,3,2,3,2,2,3,2,2,2,2,2,2,2,2,3,2,2,3,2,2,2

%N Number of divisors of n that are also suffixes of n in binary representation.

%C a(n) = 1 iff n = 2^k (A000079), the only divisor is n itself.

%C For a(n) > 1 the other trivial divisor is 1 for odd numbers and 2 for even numbers (A057716).

%H Reinhard Zumkeller, <a href="/A080942/b080942.txt">Table of n, a(n) for n = 1..10000</a>

%F a(A080943(n)) = 2.

%F a(A080945(n)) > 2.

%F a(A080946(n)) = 3.

%F a(A080947(n)) > 3.

%F a(n) <= A000005(n).

%F a(p) = 2 for odd primes p.

%F a(A080948(n)) = n and a(m) < n for m < A080948(n).

%e n=63 has A000005(63)=6 divisors: 1='1', 3='11', 7='111', 9='1001', 21='10101' and 63='111111', {1,11,111,111111} are also suffixes of 111111, therefore a(63)=4.

%t a[n_] := DivisorSum[n, 1 &, Mod[n, 2^BitLength[#]] == # &]; Array[a, 100] (* _Amiram Eldar_, Apr 07 2023 *)

%o (Haskell)

%o import Data.List (isPrefixOf); import Data.Function (on)

%o a080942 n = length $

%o filter ((flip isPrefixOf `on` a030308_row) n) $ a027750_row n

%o -- _Reinhard Zumkeller_, Mar 27 2014

%o (Python)

%o from sympy import divisors

%o def A080942(n): return sum(1 for d in divisors(n,generator=True) if not (d^n)&((1<<d.bit_length())-1)) # _Chai Wah Wu_, Jun 20 2023

%Y Cf. A007088, A080940, A080941, A080943, A080945, A080946, A080947, A080948.

%Y Cf. A000005, A027750, A030308, A057716, A239826.

%K nonn,base

%O 1,3

%A _Reinhard Zumkeller_, Feb 25 2003