cp's OEIS Frontend

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.

A077187 Smallest k such that the concatenation 123...(k-1) k (k-1)...321 ( a concatenation of natural numbers from 1 to k and back to 1) is a multiple of prime(n), or 0 if no such number exists.

Original entry on oeis.org

0, 3, 0, 6, 2, 6, 109, 103, 100001, 1006, 17, 3, 5, 103, 1000002, 100012, 1019, 1002, 1001, 16, 8, 105, 1036, 104, 1002, 4, 100000000009, 100004, 52, 156, 10000000012, 1062, 8, 1002, 28, 102, 1011, 1000062, 30, 10001, 118, 52, 43, 10058, 34, 47
Offset: 1

Views

Author

Amarnath Murthy, Nov 01 2002

Keywords

Examples

			a(5) = 2 as 121 is a multiple of 11.
		

Crossrefs

Programs

  • PARI
    { a(n) = local(p,c10,z,u,v,l,k,lk,L,q); p=prime(n); c10=Mod(10,p); z=znorder(c10); u=v=Mod(1,p); l=1; k=2; L=List(); while(1, lk=1+log(k+0.1)\log(10); if(k==10^(lk-1), L=List()); if( u*c10^(l+lk)+k*c10^l+v==0, return(k)); q=0; t=[u,v,k%p,l%z]; for(j=1,#L,if(t==L[j], q=1+#L-j)); if(q, k+=((10^lk-1-k)\q)*q; L=List(), listput(L,t)); u=u*c10^lk+k; v+=k*c10^l; l+=lk; k++) } \\ Max Alekseyev, Sep 11 2009

Extensions

3 more terms from Erich Friedman, Aug 08 2005
Extended by Max Alekseyev, Sep 11 2009