|
|
A078211
|
|
Smallest multiple of n^2 beginning and ending in n, or 0 if no such multiple exists.
|
|
1
|
|
|
1, 212, 333, 464, 525, 6156, 7007, 8128, 9639, 0, 11011, 122112, 13013, 0, 0, 162816, 1720417, 0, 1905719, 0, 212121, 0, 2320723, 244224, 25625, 0, 2743227, 287728, 2917429, 0, 3143431, 325632, 3372633, 0, 0, 3617136, 373737, 0, 393939, 0, 4136941
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
PROG
|
(PARI) { a(n) = local(l, m); l=#Str(n); m=valuation(n, 2); if(m>0 && m<l, return(0)); m=valuation(n, 5); if(m>0 && m<l, return(0)); for(j=0, l-1, if(n%10^(l-j)==n\10^j && (n*10^j + n%10^j)%n^2==0, return(n*10^j + n%10^j)); ); if((10^l+1)%n==0, return(n*(10^l+1))); m=0; g=gcd(n^2, 10^l); until(#Str(t)<=m, m++; t=lift(Mod(-n*(10^(m+l)+1)/g, n^2/g)/(10^l\g)); ); n*(10^(m+l)+1)+t*10^l } \\ Max Alekseyev, Oct 18 2008
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|