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.

A217047 Primes that remain prime when a single "8" digit is inserted between any two adjacent digits.

This page as a plain text file.
%I A217047 #27 Mar 11 2025 13:53:15
%S A217047 11,23,47,83,131,173,179,233,353,389,521,569,641,683,839,887,911,971,
%T A217047 983,1229,1289,1913,2087,2663,2837,2879,3329,3671,3677,3803,3821,4259,
%U A217047 4409,4817,4871,4889,5237,5477,5693,6449,6581,6863,7283,7487,7583,7823,7853
%N A217047 Primes that remain prime when a single "8" digit is inserted between any two adjacent digits.
%C A217047 These numbers are either isolated primes or the smaller of a pair of twin primes. - _Davide Rotondo_, Mar 11 2025
%H A217047 Paolo P. Lava, <a href="/A217047/b217047.txt">Table of n, a(n) for n = 1..500</a>
%e A217047 325421 is prime and also 3254281, 3254821, 3258421, 3285421 and 3825421.
%p A217047 A217044:=proc(q,x) local a,b,c,d,i,k,n,ok,v; v:=[]; a:=10;
%p A217047 for n from 1 to q do a:=nextprime(a); d:=length(a); ok:=1;
%p A217047 for k from 1 to d-1 do b:=a mod 10^k; c:=trunc(a/10^k); i:=x*10^k+b; i:=c*10^length(i)+i;
%p A217047 if not isprime(i) then ok:=0; break; fi; od; if ok=1 then v:=[op(v),a]; fi; od; op(v); end:
%p A217047 A217044(10^3,8);
%o A217047 (PARI) is(n)=my(v=concat([""],digits(n)));for(i=2,#v-1,v[1]=Str(v[1], v[i]); v[i]=8;if(i>2,v[i-1]="");if(!isprime(eval(concat(v))), return(0)));isprime(n) \\ _Charles R Greathouse IV_, Sep 25 2012
%o A217047 (Magma) [p: p in PrimesInInterval(11,8000) | forall{m: t in [1..#Intseq(p)-1] | IsPrime(m) where m is (Floor(p/10^t)*10+8)*10^t+p mod 10^t}]; // _Bruno Berselli_, Sep 26 2012
%o A217047 (Python)
%o A217047 from sympy import isprime, primerange
%o A217047 def ok(p):
%o A217047     if p < 10: return False
%o A217047     s = str(p)
%o A217047     return all(isprime(int(s[:i] + "8" + s[i:])) for i in range(1, len(s)))
%o A217047 def aupto(limit): return [p for p in primerange(1, limit+1) if ok(p)]
%o A217047 print(aupto(7854)) # _Michael S. Branicky_, Nov 23 2021
%Y A217047 Cf. A050674, A050711-A050719, A069246, A159236, A215417, A215419-A215421, A217044-A217046, A217062-A217065.
%K A217047 nonn,base
%O A217047 1,1
%A A217047 _Paolo P. Lava_, Sep 25 2012