A333666 Smallest k > 0 with gcd(k, rev(k)) = n, where rev(k) is digit reversal of k and with sum of digits of k = n, or 0 if no such k exists.
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 209, 48, 4000009, 21182, 5055, 21184, 13328, 288, 12844, 0, 1596, 2398, 13892, 2976, 52675, 45890, 2889, 61768, 178292, 0, 177475, 29984, 42999, 279718, 529865, 29988, 1009009009009, 485678, 1951599, 0, 694499, 655998, 1677688, 658988
Offset: 1
Examples
a(11) = 209. The sum of the digits is 11 and gcd(209,902) = 11. a(12) = 48. The sum of the digits is 12 and gcd(48,84) = 12.
Links
- Ruediger Jehn, Table of n, a(n) for n = 1..303
- Ruediger Jehn, Proofs for difficult terms
- Rüdiger Jehn, Porous Numbers, arXiv:2104.02482 [math.GM], 2021.
Programs
-
Mathematica
m = 36; s = Table[0, {m}]; c = 0; n = 1; While[c < m - Quotient[m, 10], g = GCD[n, FromDigits @ Reverse @ (d = IntegerDigits[n])]; If[g <= m && g == Plus @@ d && s[[g]] == 0, c++; s[[g]] = n]; n++]; s (* Amiram Eldar, Sep 03 2020 *)
-
PARI
a(n) = {if ((n % 10) == 0, return(0)); my(k=n); while (! ((sumdigits(k)==n) && (gcd(k, fromdigits(Vecrev(digits(k)))) == n)), k+=n); k;} \\ Michel Marcus, Sep 03 2020
-
Python
for n in range(11, 20): for k in range(n, 1000000000, n): s = str(k) revk = "" # digit reversal of k sum = 0 for i in range(len(s)): revk = revk + s[len(s) - i - 1] sum = sum + int(s[i]) g = gcd(k,int(revk)) if g == n and sum == n: print(n, k, revk, g) break
Formula
a(10*n) = 0 since all multiples of 10 have a 0 at the end, but their reverse numbers have no 0 at the end and therefore 10*n cannot be their gcd.
Comments