login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A175242
a(n) = the number of divisors of n that are palindromes when written in binary.
3
1, 1, 2, 1, 2, 2, 2, 1, 3, 2, 1, 2, 1, 2, 4, 1, 2, 3, 1, 2, 4, 1, 1, 2, 2, 1, 4, 2, 1, 4, 2, 1, 3, 2, 3, 3, 1, 1, 2, 2, 1, 4, 1, 1, 6, 1, 1, 2, 2, 2, 4, 1, 1, 4, 2, 2, 2, 1, 1, 4, 1, 2, 6, 1, 3, 3, 1, 2, 2, 3, 1, 3, 2, 1, 4, 1, 2, 2, 1, 2, 4, 1, 1, 4, 4, 1, 2, 1, 1, 6, 2, 1, 4, 1, 2, 2, 1, 2, 5, 2, 1, 4, 1, 1, 6
OFFSET
1,3
LINKS
FORMULA
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A244162 = 2.378795... . - Amiram Eldar, Jan 01 2024
EXAMPLE
a(3) = 2 since 3 has 2 divisors, 1 and 3, that are palindromes when written in binary: 1 and 11.
MAPLE
a:= n-> add(`if`(l=ListTools[Reverse](l), 1, 0), l=
map(Bits[Split], numtheory[divisors](n))):
seq(a(n), n=1..105); # Alois P. Heinz, Jul 15 2022
MATHEMATICA
palbQ[n_]:=Module[{idn2=IntegerDigits[n, 2]}, idn2==Reverse[idn2]]; Table[ Count[ Divisors[ n], _?(palbQ[#]&)], {n, 110}] (* Harvey P. Dale, Mar 27 2019 *)
a[n_] := DivisorSum[n, 1 &, PalindromeQ @ IntegerDigits[#, 2] &]; Array[a, 100] (* Amiram Eldar, Jan 01 2020 *)
PROG
(PARI) is(n) = my(d=binary(n)); d==Vecrev(d); \\ A006995
a(n) = sumdiv(n, d, is(d)); \\ Michel Marcus, Jul 15 2022
(Python)
from sympy import divisors
def c(n): b = bin(n)[2:]; return b == b[::-1]
def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jul 15 2022
CROSSREFS
Sequence in context: A035228 A035164 A023588 * A355770 A225843 A327657
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Mar 11 2010
EXTENSIONS
Extended by Ray Chandler, Mar 13 2010
STATUS
approved