login
Primes of the form identical digits preceded by a 3.
2

%I #11 Oct 03 2022 13:16:08

%S 3,31,37,311,311111,31111111111,311111111111,377777777777,

%T 31111111111111,377777777777777777,

%U 31111111111111111111111111111111111,311111111111111111111111111111111111111111111111

%N Primes of the form identical digits preceded by a 3.

%H Vincenzo Librandi, <a href="/A090151/b090151.txt">Table of n, a(n) for n = 1..18</a>

%t Select[ FromDigits /@ Flatten[ Table[ PadRight[{3}, i, # ] & /@ {1, 2, 3, 4, 5, 6, 7, 8, 9}, {i, 2, 24}], 1], PrimeQ[ # ] &]

%t Select[Union[Flatten[Table[FromDigits[PadRight[{3},n,c]],{n,1000},{c,{1,7}}]]],PrimeQ] (* _Harvey P. Dale_, Oct 03 2022 *)

%o (Python)

%o from sympy import isprime

%o def afind(terms):

%o print(3, end=", ")

%o digits, n = 1, 1

%o while n < terms:

%o for id in "17":

%o t = int('3' + id*digits)

%o if isprime(t): print(t, end=", "); n += 1

%o digits += 1

%o afind(12) # _Michael S. Branicky_, Mar 31 2021

%K nonn,base

%O 1,1

%A _Robert G. Wilson v_, Nov 22 2003