cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A360781 Primes p such that at least one number remains prime when p is bracketed by a single digit d; that is, at least one instance of d//p//d is prime where // means concatenation.

This page as a plain text file.
%I A360781 #19 Feb 24 2023 20:21:41
%S A360781 2,3,5,7,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,101,103,
%T A360781 107,109,113,131,139,149,151,157,163,173,179,191,193,197,211,223,227,
%U A360781 233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331
%N A360781 Primes p such that at least one number remains prime when p is bracketed by a single digit d; that is, at least one instance of d//p//d is prime where // means concatenation.
%C A360781 The bracketing digit d must be 1, 3, 7, or 9.
%H A360781 Michael S. Branicky, <a href="/A360781/b360781.txt">Table of n, a(n) for n = 1..10000</a>
%F A360781 Union of A069687, A069688, A069689, A069690. - _Alois P. Heinz_, Feb 22 2023
%e A360781 263 is included because 263 is a prime and 32633 (and also 92639) is a prime.
%p A360781 q:= p-> ormap(isprime, map(d-> parse(cat(d, p, d)), [1, 3, 7, 9])):
%p A360781 select(q, [ithprime(i)$i=1..67])[];  # _Alois P. Heinz_, Feb 22 2023
%t A360781 brkQ[p_]:=AnyTrue[Table[FromDigits[Join[{d},IntegerDigits[p],{d}]],{d,{1,3,7,9}}],PrimeQ]; Select[Prime[Range[100]],brkQ]
%o A360781 (Python)
%o A360781 from sympy import isprime, nextprime
%o A360781 from itertools import islice
%o A360781 def agen(): # generator of terms
%o A360781     p = 2
%o A360781     while True:
%o A360781         sp = str(p)
%o A360781         if any(isprime(int(d+sp+d)) for d in "1379"):
%o A360781             yield p
%o A360781         p = nextprime(p)
%o A360781 print(list(islice(agen(), 57))) # _Michael S. Branicky_, Feb 20 2023
%o A360781 (PARI) is(p) = my(d=digits(p)); forstep(k=1, 9, 2, if (isprime(fromdigits(concat(k, concat(d,k)))), return(1)));
%o A360781 isok(p) = if (isprime(p), is(p)); \\ _Michel Marcus_, Feb 20 2023
%Y A360781 Cf. A000040, A059694, A069687, A069688, A069689, A069690.
%K A360781 nonn,base
%O A360781 1,1
%A A360781 _Harvey P. Dale_, Feb 20 2023