login
a(n) is the smallest number that has exactly n binary palindrome divisors (A006995).
1

%I #31 Jul 23 2022 19:23:59

%S 1,3,9,15,99,45,135,189,315,495,945,765,2079,6237,3465,5355,4095,8415,

%T 31185,20475,25245,12285,85995,58905,61425,45045,69615,176715,446985,

%U 225225,328185,208845,135135,405405,528255,1396395,675675,2027025,765765,5360355,2993445,3968055,3828825

%N a(n) is the smallest number that has exactly n binary palindrome divisors (A006995).

%H Michael S. Branicky, <a href="/A355716/b355716.txt">Table of n, a(n) for n = 1..67</a>

%e a(4) = 15 since 15 has 4 divisors {1, 3, 5, 15} that are all palindromes when written in binary: 1, 11, 101 and 1111; no positive integer smaller than 15 has four divisors that are binary palindromes, hence a(4) = 15.

%e a(5) = 99 since 99 has 6 divisors {1, 3, 9, 11, 33, 99} of which only 11 is not a palindrome when written in binary: 11_10 = 1011_2; no positive integer smaller than 99 has five divisors that are binary palindromes, hence a(5) = 99.

%t f[n_] := DivisorSum[n, 1 &, PalindromeQ[IntegerDigits[#, 2]] &]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i}, While[c < len && n < nmax, i = f[n]; If[i <= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[25, 10^5] (* _Amiram Eldar_, Jul 15 2022 *)

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

%o a(n) = my(k=1); while (sumdiv(k, d, is(d)) != n, k++); k; \\ _Michel Marcus_, Jul 15 2022

%o (Python)

%o from sympy import divisors

%o from itertools import count, islice

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

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

%o def agen():

%o n, adict = 1, dict()

%o for k in count(1):

%o fk = f(k)

%o if fk not in adict: adict[fk] = k

%o while n in adict: yield adict[n]; n += 1

%o print(list(islice(agen(), 20))) # _Michael S. Branicky_, Jul 23 2022

%Y Cf. A006995, A175242, A329419, A329420.

%K nonn,base

%O 1,2

%A _Bernard Schott_, Jul 15 2022

%E More terms from _Michael S. Branicky_, Jul 15 2022