login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A240678 Primes p such that p*10+k is prime for exactly one value of the digit k. 4

%I #16 Nov 29 2021 11:31:13

%S 11,29,41,47,71,79,83,131,137,139,151,163,173,181,191,227,257,263,277,

%T 281,293,307,311,313,359,383,449,491,503,509,557,563,569,577,587,593,

%U 601,617,647,659,661,677,683,719,739,743,751,809,821,827,857,877,881

%N Primes p such that p*10+k is prime for exactly one value of the digit k.

%H Colin Barker, <a href="/A240678/b240678.txt">Table of n, a(n) for n = 1..1000</a>

%e 11 is in the sequence because 113 is prime, but 111, 117 and 119 are not prime.

%t Select[Prime[Range[200]],Total[Boole[PrimeQ[10 #+{1,3,7,9}]]]==1&] (* _Harvey P. Dale_, Apr 19 2019 *)

%o (PARI) forprime(p=2, 1500, t=0; forstep(k=1, 9, 2, if(isprime(p*10+k), t++)); if(t==1, print1(p, ", ")))

%o (Python)

%o from sympy import isprime, primerange

%o def ok(p): return sum(1 for k in [1, 3, 7, 9] if isprime(p*10+k)) == 1

%o def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]

%o print(aupto(881)) # _Michael S. Branicky_, Nov 29 2021

%Y Cf. A067267, A119289, A240679, A240680, A240689.

%K nonn,base

%O 1,1

%A _Colin Barker_, Apr 10 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 13 02:28 EDT 2024. Contains 375113 sequences. (Running on oeis4.)