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!)
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. 2
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
a(5) = 2 as 121 is a multiple of 11.
PROG
(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
CROSSREFS
Sequence in context: A171419 A077574 A071126 * A011079 A334874 A343903
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Nov 01 2002
EXTENSIONS
3 more terms from Erich Friedman, Aug 08 2005
Extended by Max Alekseyev, Sep 11 2009
STATUS
approved

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 March 29 09:14 EDT 2024. Contains 371268 sequences. (Running on oeis4.)