A083833 Palindromes p such that 5p + 1 is also a palindrome.
1, 2, 22, 121, 131, 222, 2222, 12021, 12121, 13031, 13131, 22222, 222222, 1202021, 1203021, 1212121, 1213121, 1302031, 1303031, 1312131, 1313131, 2222222, 22222222, 120202021, 120212021, 120303021, 120313021, 121202121, 121212121
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..8217 (all terms where p has <= 26 digits)
Programs
-
Mathematica
Select[Range[23*10^5],AllTrue[{#,5#+1},PalindromeQ]&] (* The program generates the first 22 terms of the sequence. *) (* Harvey P. Dale, Dec 17 2024 *)
-
Python
from itertools import product def ispal(n): s = str(n); return s == s[::-1] def pals(d, base=10): # all positive d-digit palindromes digits = "".join(str(i) for i in range(base)) for p in product(digits, repeat=d//2): if d > 1 and p[0] == "0": continue left = "".join(p); right = left[::-1] for mid in [[""], digits][d%2]: t = int(left + mid + right) if t > 0: yield t def ok(pal): return ispal(5*pal+1) print([p for d in range(1, 10) for p in pals(d) if ok(p)]) # Michael S. Branicky, Jun 11 2021
Extensions
Corrected and extended by Ray Chandler, May 21 2003
Comments