A090584 Smallest number m >= 0 such that n with m threes appended yields a prime or -1 if no such m exists.
1, 0, 0, 1, 0, -1, 0, 1, -1, 1, 0, -1, 0, 2, -1, 1, 0, -1, 0, 3, -1, 1, 0, -1, 8, 1, -1, 1, 0, -1, 0, 4, -1, 2, 1, -1, 0, 1, -1, 483, 0, -1, 0, 1, -1, 1, 0, -1, 2, 1, -1, 1, 0, -1, 3, 1, -1, 6, 0, -1, 0, 5, -1, 1, 1, -1, 0, 1, -1, 5, 0, -1, 0, 1, -1, 3, 1, -1, 0, 4, -1, 1, 0, -1, 1, 1, -1, 1, 0, -1, 2, 3, -1, 2, 1, -1, 0, 1, -1, 3, 0, -1, 0, 2, -1, 1, 0, -1, 0, 1
Offset: 1
Examples
a(25) = 8 because eight 3's must be appended to 25 before a prime is formed (2533333333). a(6) = -1 because no matter how many 3's are appended to 6, the resulting number is always divisible by 3 and can therefore not be prime. [Similarly for any larger multiple of 3. - _M. F. Hasler_, Jun 06 2024]
Links
- Toshitaka Suzuki, Table of n, a(n) for n = 1..816
Crossrefs
Programs
-
PARI
apply( {A090584(n, LIM=500)=n%3 && for(m=0, LIM, ispseudoprime(n) && return(m); n=n*10+3); -(n>3)}, [1..55]) \\ Retun value -1 means that a(n) = -1 or, for non-multiples of 3, a(n) > LIM, the search limit given as 2nd (optional) parameter. - M. F. Hasler, Jun 05 2024
Extensions
Name edited by M. F. Hasler, Jun 06 2024
Comments