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.

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

This page as a plain text file.
%I A080942 #23 Jun 21 2023 06:47:23
%S A080942 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 A080942 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 A080942 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 A080942 Number of divisors of n that are also suffixes of n in binary representation.
%C A080942 a(n) = 1 iff n = 2^k (A000079), the only divisor is n itself.
%C A080942 For a(n) > 1 the other trivial divisor is 1 for odd numbers and 2 for even numbers (A057716).
%H A080942 Reinhard Zumkeller, <a href="/A080942/b080942.txt">Table of n, a(n) for n = 1..10000</a>
%F A080942 a(A080943(n)) = 2.
%F A080942 a(A080945(n)) > 2.
%F A080942 a(A080946(n)) = 3.
%F A080942 a(A080947(n)) > 3.
%F A080942 a(n) <= A000005(n).
%F A080942 a(p) = 2 for odd primes p.
%F A080942 a(A080948(n)) = n and a(m) < n for m < A080948(n).
%e A080942 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 A080942 a[n_] := DivisorSum[n, 1 &, Mod[n, 2^BitLength[#]] == # &]; Array[a, 100] (* _Amiram Eldar_, Apr 07 2023 *)
%o A080942 (Haskell)
%o A080942 import Data.List (isPrefixOf); import Data.Function (on)
%o A080942 a080942 n = length $
%o A080942             filter ((flip isPrefixOf `on` a030308_row) n) $ a027750_row n
%o A080942 -- _Reinhard Zumkeller_, Mar 27 2014
%o A080942 (Python)
%o A080942 from sympy import divisors
%o A080942 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 A080942 Cf. A007088, A080940, A080941, A080943, A080945, A080946, A080947, A080948.
%Y A080942 Cf. A000005, A027750, A030308, A057716, A239826.
%K A080942 nonn,base
%O A080942 1,3
%A A080942 _Reinhard Zumkeller_, Feb 25 2003