%I #49 Apr 29 2024 09:30:30
%S 4,18,100,121,244,546,631,1494,2566,8088,262603,282948,359860
%N Numbers k such that 2*R_k - 1 is prime, where R_k = 11...1 is the repunit (A002275) of length k.
%C Also numbers k such that (2*10^k-11)/9 is prime.
%C Larger values correspond to strong pseudoprimes.
%C a(11) > 10^5. - _Robert Price_, Sep 06 2014
%H Makoto Kamada, <a href="https://stdkmd.net/nrr/2/22221.htm#prime">Prime numbers of the form 22...221</a>.
%H <a href="/index/Pri#Pri_rep">Index entries for primes involving repunits</a>
%F a(n) = A056660(n) + 1.
%e a(1) = 4 because 2*(10^4-1)/9-1 = 2221 is prime.
%e a(2) = 18 means that 222222222222222221 is prime.
%p select(t -> isprime(2*(10^t-1)/9-1),[$1..1000]); # _Robert Israel_, Sep 07 2014
%t Do[ If[ PrimeQ[2(10^n - 1)/9 - 1], Print[n]], {n, 0, 7000}] (* _Robert G. Wilson v_, Oct 14 2004; fixed by _Derek Orr_, Sep 06 2014 *)
%o (PARI) for(n=1, 10^4, if(ispseudoprime(2*(10^n-1)/9-1), print1(n,", "))) \\ _Derek Orr_, Sep 06 2014
%o (Python)
%o from sympy import isprime
%o def afind(limit):
%o n, twoRn = 1, 2
%o for n in range(1, limit+1):
%o if isprime(twoRn-1): print(n, end=", ")
%o twoRn = 10*twoRn + 2
%o afind(700) # _Michael S. Branicky_, Apr 18 2021
%Y Cf. A084831, A096503-A096508, A096841-A096846, A002275, A056660.
%K more,nonn
%O 1,1
%A _Jason Earls_, Jun 05 2003
%E a(8) from _Labos Elemer_, Jul 15 2004
%E a(10) from Kamada data by _Robert Price_, Sep 06 2014
%E a(11)-a(13) from Kamada data by _Tyler Busby_, Apr 29 2024