%I #21 Aug 28 2022 23:15:52
%S 2992,3883,4774,5665,6556,7447,8338,9229,10901,20702,30503,40304,
%T 50105,70807,80608,90409,119911,128821,137731,146641,155551,164461,
%U 173371,182281,191191,209902,218812,227722,236632,245542,254452,263362,272272,281182,290092,308803
%N Palindromes that are multiples of 11 and whose digit sum is also a multiple of 11.
%C Palindromes in A216995.
%e 11 is a palindrome that is a multiple of 11, but its digit sum is not divisible by 11. Thus, 11 is not in this sequence.
%t Select[Range[400000], PalindromeQ[#] && IntegerQ[#/11] && IntegerQ[Total[IntegerDigits[#]]/11] &]
%o (Python)
%o from itertools import product
%o def sd(n): return sum(map(int, str(n)))
%o def pals(d, base=10): # all positive d-digit palindromes
%o digits = "".join(str(i) for i in range(base))
%o for p in product(digits, repeat=d//2):
%o if d > 1 and p[0] == "0": continue
%o left = "".join(p); right = left[::-1]
%o for mid in [[""], digits][d%2]:
%o t = int(left + mid + right)
%o if t > 0: yield t
%o def ok(pal): return pal%11 == 0 and sd(pal)%11 == 0
%o print([p for d in range(1, 7) for p in pals(d) if ok(p)]) # _Michael S. Branicky_, Jul 11 2021
%o (PARI) isok(m) = my(d=digits(m)); (Vecrev(d) == d) && !(m % 11) && !(vecsum(d) % 11); \\ _Michel Marcus_, Aug 06 2021
%Y Cf. A002113, A083513, A166311 (halves of even length terms), A216995.
%K nonn,base
%O 1,1
%A _Tanya Khovanova_, Jul 11 2021
|