A368944 Palindromes in base 10 that are the product of two repdigit numbers.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 111, 121, 222, 242, 333, 363, 444, 484, 555, 616, 666, 777, 888, 999, 1111, 1221, 2222, 2442, 3333, 3663, 4444, 4884, 5445, 5555, 6666, 6776, 7777, 8888, 9999, 11111, 12221, 12321, 22222, 24442, 24642
Offset: 1
Examples
121 = 11*11, 222 = 111*2, 242 = 22*11, ...
Programs
-
Mathematica
repQ[n_] := SameQ @@ IntegerDigits[n]; q[n_] := PalindromeQ[n] && AnyTrue[Divisors[n], repQ[#] && repQ[n/#] &]; q[0] = True; Select[Range[0, 25000], q] (* Amiram Eldar, Jan 12 2024 *)
-
Python
from itertools import count, takewhile def ispal(n): return (s:=str(n)) == s[::-1] def repdigits(): yield 0 yield from ((10**d-1)//9*i for d in count(1) for i in range(1, 10)) def aupto(LIMIT): # use LIMIT = 10**450 for 10K+-term b-file s, R = set(), list(takewhile(lambda x:x<=LIMIT, repdigits())) for i, r1 in enumerate(R): for r2 in R[i:]: p = r1*r2 if p > LIMIT: break if ispal(p): s.add(p) return sorted(s) print(aupto(3*10**4)) # Michael S. Branicky, Jan 10 2024
Comments