A328455 Least prime p such that all digits of p*prime(n) are the same (or -1 if p does not exist).
2, 2, 11, 11, 2, -1, -1, -1, -1, -1, -1, 3, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4649, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Offset: 1
Examples
Prime(5) is 11 and the least prime p such that all the digits of p*prime(5) are the same is 2 (as 2*11 = 22). a(6) = -1 as repdigits are of the form k*(10^m - 1)/9, 1 <= k <= 9. We need the repdigit to be a semiprime of the form 13*p for some prime p. We need m = 6*t for some t >= 1. So (7*13) || (10^m - 1)/9, i.e., (10^m - 1)/9 can't be a semiprime and a(6) = -1. - _David A. Corneth_, Oct 16 2019
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local o,p,q; p:= ithprime(n); o:= numtheory:-order(10,p); q:= (10^o-1)/(9*p); if isprime(q) then q elif q = 1 then 2 else -1 fi end proc: 2,2,11,11,seq(f(n),n=5..100); # Robert Israel, Nov 19 2019
-
Mathematica
a[1]=a[2]=2;a[3]=a[4]=11; a[n_]:= Which[Union[IntegerDigits[Prime[n]]]=={1},2, Module[{i=1},While[!Divisible[(10^i-1),9*Prime[n]],i++]; k=(10^i-1)/(9*Prime[n]); PrimeQ[k]],k,True,-1]; a/@Range[85] (* Ivan N. Ianakiev, Oct 24 2019 *)
-
PARI
a(n) = if(n<=5, return([2, 2, 11, 11, 2][n])); my(p=prime(n)); for(i=1, oo, if((10^i-1)/9%p==0, c=(10^i-1)/(9*p); if(isprime(c), return(c), return(-1)))) \\ David A. Corneth, Oct 22 2019
Extensions
More terms from Bernard Schott and David A. Corneth, Oct 22 2019
Comments