This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A061906 #16 Feb 13 2025 21:15:20 %S A061906 1,1,1,1,1,1,1,1,1,1,1,1,21,38,18,35,17,16,14,9,1,12,1,7,29,21,19,37, %T A061906 9,8,1,14,66,1,8,15,7,3,13,15,1,16,6,23,1,13,9,3,44,7,1,19,13,4,518,1, %U A061906 11,3,4,13,1,442,7,4,33,9,1,11,4,6,1,845,88,4,3,7,287,1,11,6,1,12345679,8 %N A061906 Obtain m by omitting trailing zeros from n; a(n) = smallest k such that k*m is a palindrome. %C A061906 Every positive integer is a factor of a palindrome, unless it is a multiple of 10 (D. G. Radcliffe, see Links). %C A061906 Every integer n has a multiple of the form 99...9900...00. To see that n has a multiple that's a palindrome (allowing 0's on the left) with even digits, let 9n divide 99...9900...00; then n divides 22...2200...00. - _Dean Hickerson_, Jun 29 2001 %H A061906 Chai Wah Wu, <a href="/A061906/b061906.txt">Table of n, a(n) for n = 0..8180</a> %H A061906 P. De Geest, <a href="https://www.worldofnumbers.com/em36.htm">Smallest multipliers to make a number palindromic</a>. %e A061906 For n = 30 we have m = 3, 1*m = 3 is a palindrome, so a(30) = 1. For n = m = 12 the smallest palindromic multiple is 21*m = 252, so a(12) = 21. %t A061906 skp[n_]:=Module[{m=n/10^IntegerExponent[n,10],k=1},While[!PalindromeQ[k*m],k++];k]; Array[ skp,90,0] (* _Harvey P. Dale_, Jul 04 2024 *) %o A061906 (ARIBAS) stop := 20000000; for n := 0 to maxarg do k := 1; test := true; while test and k < stop do mp := omit_trailzeros(n)*k; if test := mp <> int_reverse(mp) then inc(k); end; end; if k < stop then write(k," "); else write(-1," "); end; end; %o A061906 (Python) %o A061906 from __future__ import division %o A061906 def palgen(l, b=10): # generator of palindromes in base b of length <= 2*l %o A061906 if l > 0: %o A061906 yield 0 %o A061906 for x in range(1, l+1): %o A061906 n = b**(x-1) %o A061906 n2 = n*b %o A061906 for y in range(n, n2): %o A061906 k, m = y//b, 0 %o A061906 while k >= b: %o A061906 k, r = divmod(k, b) %o A061906 m = b*m + r %o A061906 yield y*n + b*m + k %o A061906 for y in range(n, n2): %o A061906 k, m = y, 0 %o A061906 while k >= b: %o A061906 k, r = divmod(k, b) %o A061906 m = b*m + r %o A061906 yield y*n2 + b*m + k %o A061906 def A050782(n, l=10): %o A061906 if n % 10: %o A061906 x = palgen(l) %o A061906 next(x) # replace with x.next() in Python 2.x %o A061906 for i in x: %o A061906 q, r = divmod(i, n) %o A061906 if not r: %o A061906 return q %o A061906 else: %o A061906 return 'search limit reached.' %o A061906 else: %o A061906 return 0 %o A061906 def A061906(n, l=10): %o A061906 return A050782(int(str(n).rstrip('0')),l) if n > 0 else 1 %o A061906 # _Chai Wah Wu_, Dec 30 2014 %Y A061906 Cf. A050782, A062293, A061915, A061916, A061816. Values of k*m are given in A061906. %K A061906 base,easy,nonn %O A061906 0,13 %A A061906 _Klaus Brockhaus_, Jun 25 2001