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.

A175242 a(n) = the number of divisors of n that are palindromes when written in binary.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Mar 11 2010

Keywords

Examples

			a(3) = 2 since 3 has 2 divisors, 1 and 3, that are palindromes when written in binary: 1 and 11.
		

Crossrefs

Programs

  • 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 *)
  • 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

Formula

Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A244162 = 2.378795... . - Amiram Eldar, Jan 01 2024

Extensions

Extended by Ray Chandler, Mar 13 2010