OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
PROG
(Python)
from sympy import isprime
from itertools import count, product
def f(s): return int("".join(str(abs(9 - 2*int(c))) for c in s))
def pals(base=10): # all (nonzero) palindromes as strings
digits = "".join(str(i) for i in range(base))
for d in count(1):
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 = left + mid + right
if t != '0': yield t
def aupton(nn): p = pals(); return [f(next(p)) for i in range(nn)]
print(aupton(58)) # Michael S. Branicky, Jul 05 2021
(Python)
def A085927(n):
y = 10*(x:=10**(len(str(n+1>>1))-1))
m = str((c:=n+1-x)*x+int(str(c)[-2::-1] or 0) if n+1<x+y else (c:=n+1-y)*y+int(str(c)[::-1] or 0))
return int(''.join('9753113579'[int(d)] for d in m)) # Chai Wah Wu, Jul 24 2024
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy and Jason Earls, Jul 13 2003
EXTENSIONS
Edited and extended by David Wasserman, Feb 11 2005
STATUS
approved