login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = smallest number m > 0 such that n followed by m 1's yields a prime, or -1 if no such m exists.
8

%I #33 Dec 31 2023 00:51:48

%S 1,2,1,1,5,1,1,2,2,1,17,136,1,9,1,3,8,1,1,2,1,3,2,1,1,3,1,1,6,2,1,35,

%T 1,6,2,4,-1,-1,2,1,2,1,1,3,772,1,3,5,1,2,4,1,9,1,31,18470,1,3,18,1,4,

%U 2,1,1,3,1,210,3,1,1,6,2,7,2,1,1,9,4,3,2,1,1,2,5,6,3,149,1,6,2,1,3,2,1,2,7,1,2,1,10,2,1,1,44,1,1,2,5,1,17,16,3,2,2,1,9,1,1

%N a(n) = smallest number m > 0 such that n followed by m 1's yields a prime, or -1 if no such m exists.

%C There are infinitely many values of n for which no such m exists. For example, every number in the sequence 13531, 135311, 1353111, 13531111, ..., is divisible by 3, 7, 11, or 13, so a(1353) does not exist. The same is true for 1353 + 3003k for k = 1, 2, 3, .... These are not the only examples. I do not know whether 1353 is the smallest example. - _Gerry Myerson_, Feb 12 2003

%C Terms from _Robert G. Wilson v_.

%C a(37)=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. - _Jason Earls_, Jun 16 2003

%C a(37) = -1 because 37 followed by any positive number, m say, of 1's is divisible by at least one of the primes {7,3,37,13}. Proof: 371 is divisible by 7, as is 111111, so this covers m = 1 mod 6 1's. 3711 is divisible by 3, as is 111, so this covers m = 2 mod 3 1's. 37111 is divisible by 37, as is 111, so this covers m = 0 mod 3 1's. 371111 is divisible by 13, as is 111111, so this covers m = 4 mod 6 1's and the proof is complete. - _Ray Chandler_, Mar 31 2004

%C a(38) = -1 because 38 followed by any positive number, m say, of 1's is divisible by 3 or 37 or by (7*10^k-1)/3 if m = 3k. Proof: 381 is divisible 3, as is 111, so this covers 1 mod 3 1's. 3811 is divisible by 37, as is 111, so this covers 2 mod 3 1's. The terms remaining are 38111, 38111111, etc. so the general form is 38*10^(3k)+(10^(3k)-1)/9. This is the same as (343*10^(3k)-1)/9 = ((7*10^k)^3-1)/9 which has integer factors (7*10^k-1)/3 and ((7*10^k)^2 + 7*10^k +1)/3 and can't be prime, so this covers 0 mod 3 1's and the proof is complete. - _Ray Chandler_, Mar 31 2004

%C From _Toshitaka Suzuki_, Nov 07 2023: (Start)

%C a(n) = -1 when n = 10101*k + 37, 371, 3711, 4044, 5625, 5746, 6623, 6808, 6956, 7475, 8743 or 8955, because n followed by any positive number, m say, of 1's is divisible by at least one of the primes {3,7,13,37}.

%C Similarly,

%C a(n) = -1 when n = 3003*k + 176, 209, 1023, 1222, 1353, 1519, 1761, 1904, 1937, 2091, 2596 or 2893 by primes {3,7,11,13};

%C a(n) = -1 when n = 8547*k + 407, 814, 936, 1750, 2146, 2739, 4071, 4367, 4488, 5402, 6523 or 8141 by primes {3,7,11,37};

%C a(n) = -1 when n = 15873*k + 2739, 4070, 5809, 6623, 6930, 8955, 9483, 10186, 10472, 11518, 11804 or 15466 by primes {3,11,13,37};

%C a(n) = -1 when n = 37037*k + 936, 1222, 9361, 10186, 11100, 12221, 18612, 19537, 26048, 27787, 35938 or 36927 by primes {7,11,13,37};

%C a(n) = -1 when n = 11111111*k + 2096963, 2964654, 7424319, 7576525, 8074243, 9098585, 9696313 or 9858520 by primes {11,73,101,137}.

%C a(38) = -1 because 38 followed by any positive number, m say, of 1's is divisible by 3 or 37 or by (7*10^k-1)/3 if m = 3k.

%C The general form is:

%C a(n) = -1 when n = ((333*s+t)^3-1)/9, divisible by 3 or 37 or by ((333*s+t)*10^k-1)/3 if m = 3k where s >= 0 and t=7, 34, 49, 70, 157 or 238.

%C The specific values of n are 38, 4367, 13072, 38111, 429988, 1497919, 4367111, 5492318, 6193663, 7272314, 13072111, 20685490, ..., so a(n) = -1 when n = 38, 381, 3811, 4367, 13072, 38111, 43671, 130721, 381111, 429988, 436711, 1307211, 1497919, 3811111, 4299881, 4367111, ... .

%C a(603) > 300000 or a(603) = -1.

%C (End)

%H Toshitaka Suzuki, <a href="/A069568/b069568.txt">Table of n, a(n) for n = 1..602</a>

%H Lenny Jones, <a href="http://www.jstor.org/stable/10.4169/amer.math.monthly.118.02.153">When does appending the same digit repeatedly on the right of a positive integer generate a sequence of composite numbers?</a>, Amer. Math. Monthly, 118 (2011), 153-160.

%H Jon Perry, <a href="https://web.archive.org/web/20070220134129/http://www.users.globalnet.co.uk:80/~perry/maths/wildeprimes/wildeprimes.htm">Wilde Primes</a>.

%H Toshitaka Suzuki, <a href="/A069568/a069568.txt">Additional n such that a(n)=-1</a>

%e a(5) = 5 as the smallest prime of the type 5 followed by 1's is 511111 (though 5 itself is a prime).

%t Do[k = 1; While[ !PrimeQ[ ToExpression[ StringJoin[ ToString[n], ToString[(10^k - 1)/9]]]], k++ ]; Print[k], {n, 1, 100}] (* _Robert G. Wilson v_ *)

%o (PARI) { aopo(n) = local(c, k, stop); c=1; k=n; stop=500; k=k*10+1; while(!isprime(k) && c<stop, k=k*10+1; c++); if(c<stop, return(c), return(-1)); }

%K sign,base

%O 1,2

%A _Amarnath Murthy_, Mar 24 2002

%E More terms from _Jason Earls_, Jun 16 2003