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”).

Least prime p such that all digits of p*prime(n) are the same (or -1 if p does not exist).
1

%I #71 Jun 06 2021 07:59:43

%S 2,2,11,11,2,-1,-1,-1,-1,-1,-1,3,271,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

%T -1,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

%U -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

%N Least prime p such that all digits of p*prime(n) are the same (or -1 if p does not exist).

%C From _Bernard Schott_, Oct 22 2019: (Start)

%C Proposition:

%C For n >= 5, there exist terms a(n) <> -1 iff

%C * prime(n) is a prime repunit with m 1's and m is in A004023, then a(n) = 2, or

%C * prime(n) is a divisor of a semiprime repunit with m 1's and m is in A046413, then a(n) is the other prime factor of this semiprime.

%C Proof:

%C We must solve a(n) * prime(n) = repdigit = k * repunit, 1<= k <= 9, with a(n) least prime p that is solution.

%C According to the unicity of prime factorization, only two possibilities:

%C * prime(n) is repunit, then a(n) = k = 2 (smallest prime).

%C * prime(n) is not a repunit, then a(n) * prime(n) must be a repunit that is semiprime, then k = 1 and a(n) is the other factor of this semiprime.

%C Some examples:

%C Case 1: prime(n) is a repunit.

%C The first few values of m are 2, 19, 23, ...

%C If this repunit is the k-th prime, then a(k) = 2; it is the case for prime(5) = 11 with a(5) = 2 (see example).

%C Case 2: prime(n) is a divisor of repunit.

%C The first few values of m are 3, 4, 5, 7, 11, 17, 47, 59, 71, ...

%C For m = 3, 111 = 3 * 37.

%C As 37 = prime(12), a(12) = 3 with 3 * 37 = 111.

%C As 3 = prime(2) and a(2) = 2 < 37, 37 is not right here.

%C For m = 4, 1111 = 11 * 101.

%C As 101 = prime(26), a(26) = 11 with 11 * 101 = 11111.

%C As 11 = prime(5) and a(5) = 2 < 101, 101 is not right here.

%C For m = 5, 11111 = 41 * 271, so as prime(13) = 41 and prime(58) = 271, then a(13) = 271, and (58) = 41.

%C For m = 7, 1111111 = 239 * 4649, so a(52) = 4649 and a(628) = 239.

%C (End)

%C a(n) is positive for n in {1,2,3,4,5,12,13,26,52,58,628,2431,2968,42536,...}. - _Ivan N. Ianakiev_, Oct 26 2019

%C If n > 4, a(n) = 2 if A077573(n) = prime(n), A077573(n)/prime(n) if that is prime, otherwise -1. - _Robert Israel_, Nov 19 2019

%H Robert Israel, <a href="/A328455/b328455.txt">Table of n, a(n) for n = 1..10000</a>

%e 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).

%e 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

%p f:= proc(n) local o,p,q;

%p p:= ithprime(n);

%p o:= numtheory:-order(10,p);

%p q:= (10^o-1)/(9*p);

%p if isprime(q) then q elif q = 1 then 2 else -1 fi

%p end proc:

%p 2,2,11,11,seq(f(n),n=5..100); # _Robert Israel_, Nov 19 2019

%t a[1]=a[2]=2;a[3]=a[4]=11; a[n_]:= Which[Union[IntegerDigits[Prime[n]]]=={1},2,

%t Module[{i=1},While[!Divisible[(10^i-1),9*Prime[n]],i++]; k=(10^i-1)/(9*Prime[n]);

%t PrimeQ[k]],k,True,-1]; a/@Range[85] (* _Ivan N. Ianakiev_, Oct 24 2019 *)

%o (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

%K sign,base

%O 1,1

%A _Ivan N. Ianakiev_, Oct 16 2019

%E More terms from _Bernard Schott_ and _David A. Corneth_, Oct 22 2019