OFFSET
3,2
COMMENTS
A positive integer that is a multiple of 3 ends with 0 in base 3, so it cannot be a palindrome in base 3.
A positive integer that is a multiple of 9 ends with 0 in base 9, so it cannot be a palindrome in base 9.
From Michael S. Branicky, Aug 15 2024: (Start)
Regarding a(2): To be a palindrome in base 2, it must end with 1, hence odd. To be odd and have digit sum 2 in base 10, it must be of the form t_d = 10^(d-1) + 1, d > 1 (a d-digit base-10 number). t_d is not divisible by 3, and base-2 palindromes with even length (i.e., number of binary digits) are divisible by 3, so, if a(2) exists, it must be a base-2 palindrome with odd length.
Computer search shows no such terms with d <= 10^6, so a(2), if it exists, has > 10^6 decimal digits. (End)
LINKS
Michael S. Branicky, Table of n, a(n) for n = 3..149
Michael S. Branicky, Python programs for OEIS A375387
Jean-Marc Rebert, a375387_1e10
EXAMPLE
a(5) = 41, because 4 + 1 = 5 and 41 = 131_5, and no lesser number has this property.
First terms are:
130 = 2002_4
41 = 131_5
123 = 3323_6
16 = 22_7
170 = 252_8
PROG
(PARI) isok(k, n) = if (sumdigits(k)==n, my(d=digits(k, n)); d==Vecrev(d));
a(n) = if ((n==3) || (n==9), return((-1))); my(k=1); while (!isok(k, n), k++); k; \\ Michel Marcus, Aug 13 2024
(Python) # see Links for faster variants
from itertools import count
from sympy.ntheory import is_palindromic
def a(n):
if n in {3, 9}: return -1
return next(k for k in count(10**(n//9)-1) if sum(map(int, str(k)))==n and is_palindromic(k, n))
print([a(n) for n in range(3, 47)]) # Michael S. Branicky, Aug 13 2024
CROSSREFS
KEYWORD
sign,base
AUTHOR
Jean-Marc Rebert, Aug 13 2024
STATUS
approved