login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A175242 a(n) = the number of divisors of n that are palindromes when written in binary. 3

%I #26 Jan 01 2024 07:59:24

%S 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,

%T 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,

%U 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

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

%H Amiram Eldar, <a href="/A175242/b175242.txt">Table of n, a(n) for n = 1..10000</a>

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

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

%p a:= n-> add(`if`(l=ListTools[Reverse](l), 1, 0), l=

%p map(Bits[Split], numtheory[divisors](n))):

%p seq(a(n), n=1..105); # _Alois P. Heinz_, Jul 15 2022

%t palbQ[n_]:=Module[{idn2=IntegerDigits[n,2]},idn2==Reverse[idn2]]; Table[ Count[ Divisors[ n],_?(palbQ[#]&)],{n,110}] (* _Harvey P. Dale_, Mar 27 2019 *)

%t a[n_] := DivisorSum[n, 1 &, PalindromeQ @ IntegerDigits[#, 2] &]; Array[a, 100] (* _Amiram Eldar_, Jan 01 2020 *)

%o (PARI) is(n) = my(d=binary(n)); d==Vecrev(d); \\ A006995

%o a(n) = sumdiv(n, d, is(d)); \\ _Michel Marcus_, Jul 15 2022

%o (Python)

%o from sympy import divisors

%o def c(n): b = bin(n)[2:]; return b == b[::-1]

%o def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))

%o print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Jul 15 2022

%Y Cf. A006995, A244162.

%K base,nonn

%O 1,3

%A _Leroy Quet_, Mar 11 2010

%E Extended by _Ray Chandler_, Mar 13 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 18:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)