OFFSET
1,1
COMMENTS
Comparable to A070837, but such a number provably exists: if n is coprime to 10 then take 10^k where k is the order of 10 mod n; else take a>b>0 such that n divides 10^a - 10^b, then the number 10^(a+b) + 10^b + 1 works.
The n-th term in this sequence is equal to the first nonzero term of A070837 that occurs at an index divisible by n/gcd(n,9).
LINKS
Erick B. Wong, Table of n, a(n) for n = 1..10000
EXAMPLE
For n=6, a(6)=13 is congruent to 31 mod 6.
For n=10, note that any number of 3 or fewer digits is necessarily a palindrome if the first digit equals the last, and 1011 is the first 4-digit non-palindrome.
MATHEMATICA
seq[len_] := Module[{s = Table[0, {len}], c = 0, k = 9, d}, While[c < len, k++; krev = IntegerReverse[k]; If[k != krev, d = Select[Divisors[Abs[k - krev]], # <= len &]; Do[If[s[[d[[i]]]] == 0, s[[d[[i]]]] = k; c++], {i, 1, Length[d]}]]]; s]; seq[60] (* Amiram Eldar, May 31 2025 *)
PROG
(Python)
from functools import partial
from itertools import count
def accept(mod, k):
r = int(str(k)[::-1])
return r != k and (r-k) % mod == 0
def a(n):
return next(filter(partial(accept, n), count(10)))
print([a(n) for n in range(1, 57)])
(PARI) a(n) = my(k=1, d=digits(k), rd=Vecrev(d)); while(!((d != rd) && Mod(fromdigits(rd), n) == k), k++; d=digits(k); rd=Vecrev(d)); k; \\ Michel Marcus, May 30 2025
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Erick B. Wong, May 29 2025, at the suggestion of Lanny Wong
STATUS
approved
