A090464 Smallest number m such that n with by m sevens appended yields a prime, or -1 if no such m exists.
1, 0, 0, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, -1, 1, 1, 0, 2, 0, 6, -1, 1, 0, 2, 1, 2, 1, -1, 0, 1, 0, 5, 1, 1, -1, 1, 0, 2, 1, 12, 0, -1, 0, 3, 1, 1, 0, 1, -1, 2, 8, 7, 0, 1, 1, -1, 1, 1, 0, 1, 0, 2, -1, 1, 2, 5, 0, 3, 2, -1, 0, 1, 0, 2, 1, 3, -1, 1, 0, 3, 4, 1, 0, -1, 1, 2, 1, 1, 0, 1, -1, 2, 1, 1
Offset: 1
Examples
a(20) = 6 because six 7's must be appended to 20 before a prime is formed (20777777). a(14) = -1 because no matter how many 7's are appended to 14, the resulting number is always divisible by 7 and can therefore not be prime.
Links
- Toshitaka Suzuki, Table of n, a(n) for n = 1..4443
Crossrefs
Programs
-
PARI
apply( {A090464(n, LIM=500)=n%7 && for(m=0, LIM, ispseudoprime(n) && return(m); n=n*10+7); -(n>7)}, [1..55]) \\ Retun value -1 means that a(n) = -1 or, if n%7 > 0, then possibly a(n) > LIM, the search limit given as 2nd (optional) parameter. - M. F. Hasler, Jun 05 2024
Comments