login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A050782 Smallest positive multiplier m such that m*n is palindromic (or zero if no such m exists). 19

%I #40 Feb 07 2022 03:41:32

%S 0,1,1,1,1,1,1,1,1,1,0,1,21,38,18,35,17,16,14,9,0,12,1,7,29,21,19,37,

%T 9,8,0,14,66,1,8,15,7,3,13,15,0,16,6,23,1,13,9,3,44,7,0,19,13,4,518,1,

%U 11,3,4,13,0,442,7,4,33,9,1,11,4,6,0,845,88,4,3,7,287,1,11,6,0,12345679,8

%N Smallest positive multiplier m such that m*n is palindromic (or zero if no such m exists).

%C Multiples of 81 require the largest multipliers.

%C From _Jon E. Schoenfield_, Jan 15 2015: (Start)

%C In general, a(n) is large when n is a multiple of 81. E.g., for n in [1..10000], of the 9000 terms where a(n)>0, 111 are at indices n that are multiples of 81; of the remaining 8889 terms,

%C 755 are in [1..9],

%C 1760 are in [10..99],

%C 3439 are in [100..999],

%C 2180 are in [1000..9999],

%C 708 are in [10000..99999],

%C 36 are in [100000..999999],

%C 6 are in [1000000..9999999],

%C 2 are in [10000000..99999999],

%C 2 are in [100000000..999999999],

%C and 1 (the largest) is a(8891) = 8546948927,

%C but the smallest of the 111 terms whose indices are multiples of 81 is a(2997)=333667. (End)

%C a(n) = 0 iff 10 | n. a(n) = 1 iff n is a palindrome. If k | a(n) then a(k*n) = a(n)/k. - _Robert Israel_, Jan 15 2015

%H Giovanni Resta, <a href="/A050782/b050782.txt">Table of n, a(n) for n = 0..10000</a> (first 8181 terms from Chai Wah Wu)

%H Patrick De Geest, <a href="http://www.worldofnumbers.com/index.html">World!Of Numbers</a>

%e E.g., a(81) -> 81 * 12345679 = 999999999 and a palindrome.

%p digrev:= proc(n) local L,d,i;

%p L:= convert(n,base,10);

%p d:= nops(L);

%p add(L[i]*10^(d-i),i=1..d);

%p end proc:

%p f:= proc(n)

%p local d,d2,x,t,y;

%p if n mod 10 = 0 then return 0 fi;

%p if n < 10 then return 1 fi;

%p for d from 2 do

%p if d::even then

%p d2:= d/2;

%p for x from 10^(d2-1) to 10^d2-1 do

%p t:= x*10^d2 + digrev(x);

%p if t mod n = 0 then return(t/n) fi;

%p od

%p else

%p d2:= (d-1)/2;

%p for x from 10^(d2-1) to 10^d2-1 do

%p for y from 0 to 9 do

%p t:= x*10^(d2+1)+y*10^d2+digrev(x);

%p if t mod n = 0 then return(t/n) fi;

%p od

%p od

%p fi

%p od;

%p end proc:

%p seq(f(n),n=0 .. 100); # _Robert Israel_, Jan 15 2015

%t t={0}; Do[i=1; If[IntegerQ[n/10],y=0,While[Reverse[x=IntegerDigits[i*n]]!=x,i++]; y=i]; AppendTo[t,y],{n,80}]; t (* _Jayanta Basu_, Jun 01 2013 *)

%o (Python)

%o from __future__ import division

%o def palgen(l,b=10): # generator of palindromes in base b of length <= 2*l

%o if l > 0:

%o yield 0

%o for x in range(1,l+1):

%o n = b**(x-1)

%o n2 = n*b

%o for y in range(n,n2):

%o k, m = y//b, 0

%o while k >= b:

%o k, r = divmod(k,b)

%o m = b*m + r

%o yield y*n + b*m + k

%o for y in range(n,n2):

%o k, m = y, 0

%o while k >= b:

%o k, r = divmod(k,b)

%o m = b*m + r

%o yield y*n2 + b*m + k

%o def A050782(n, l=10):

%o if n % 10:

%o x = palgen(l)

%o next(x) # replace with x.next() in Python 2.x

%o for i in x:

%o q, r = divmod(i, n)

%o if not r:

%o return q

%o else:

%o return 'search limit reached.'

%o else:

%o return 0 # _Chai Wah Wu_, Dec 30 2014

%Y Cf. A002113, A020485, A050810.

%K nonn,base,nice

%O 0,13

%A _Patrick De Geest_, Oct 15 1999

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)