A077186 Smallest multiple of prime(n) of the form 123...(k-1) k (k-1)...321 ( a concatenation of natural numbers from 1 to k and back to 1), or 0 if no such number exists.
0, 12321, 0, 12345654321, 121, 12345654321
Offset: 1
Programs
-
PARI
palid(n)= { local(resul) ; resul=concat("",n) ; forstep(i=n-1,1,-1, resul=concat(i,resul) ; resul=concat(resul,i) ; ) ; return(eval(resul)) ; } A077186(n)= { local(p) ; if(n==1 || n==3, return(0) ; ) ; p=prime(n) ; for(i=1,1500, if( palid(i)%p ==0, return(i) ; break ; ) ; ) ; return(-1) ; } for(n=1,20, print("n=",n," k=",A077186(n)) ; ) ; \\ R. J. Mathar, May 06 2006
Extensions
More terms from R. J. Mathar, May 06 2006
Comments