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.

A083747 Smallest number m >= 0 such that n followed by m ones yields a prime; a(p) = -1 if no such m exists.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 2, 2, 1, 0, 136, 0, 9, 1, 3, 0, 1, 0, 2, 1, 3, 0, 1, 1, 3, 1, 1, 0, 2, 0, 35, 1, 6, 2, 4, 0, -1, 2, 1, 0, 1, 0, 3, 772, 1, 0, 5, 1, 2, 4, 1, 0, 1, 31, 18470, 1, 3, 0, 1, 0, 2, 1, 1, 3, 1, 0, 3, 1, 1, 0, 2, 0, 2, 1, 1, 9, 4, 0, 2, 1, 1, 0, 5, 6, 3, 149, 1, 0, 2, 1, 3, 2, 1, 2, 7, 0, 2, 1, 10, 0, 1, 0, 44, 1, 1, 0, 5, 0, 17, 16, 3, 0, 2, 1, 9, 1, 1, 5, 1
Offset: 1

Views

Author

Jason Earls, Jun 16 2003

Keywords

Comments

a(38) = -1 means no prime has yet been found; a(176) = -1 because it has been proved never to reach a prime. a(45) = 772 and a(56) = 18470 found by Richard Heylen; a(45) has been proved prime while a(56) is 3-PRP.
Number of times 1 has to be repeatedly appended to n to form a prime. - Lekraj Beedassy, Jun 01 2006
The statement "no prime has yet been found" is misleading: if a(n) was unknown, the terms listed here should stop at a(n-1). A term a(n) = -1 means it can be proven that it will never yield a prime. We can show this for n = 38, see Examples. - M. F. Hasler, Jun 05 2024

Examples

			a(8) = 2 because 8 and 81 are composite but 811 is prime.
From _M. F. Hasler_, Jun 05 2024: (Start)
For n = 38, a(38) = -1 because the number 38 with m ones appended is divisible by 3 whenever m == 1 (mod 3) and by 37 for m == 2 (mod 3), and for m = 3k, k >= 0, it equals (x^3 - 1)/9 = (x - 1)/3 * (x^2 + x + 1)/3 with x = 7*10^k.
For n = 176, a(176) = -1 because appending any number m of 1's will always yield a number divisible by 11 if m is even, by 3 if m == 1 (mod 3), by 7 if m == 5 (mod 6) or by 13 if m == 3 (mod 6). (End)
		

Crossrefs

Cf. A069568.

Programs

  • PARI
    { aop(n, stop=500) = for(c=0, stop, isprime(n) && return(c); n=n*10+1); -1 } \\ Return value -1 means that a(n) = -1 or a(n) > stop, the search limit given as 2nd optional parameter.

Extensions

Definition and PARI/GP code edited by M. F. Hasler, Jun 05 2024