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.

A245878 Primes p such that p - d and p + d are also primes, where d is the smallest nonzero digit of p.

This page as a plain text file.
%I A245878 #15 Nov 26 2024 02:17:11
%S A245878 67,607,6977,68897,69067,69997,79867,80677,88867,97967,609607,660067,
%T A245878 669667,676987,678767,697687,707677,766867,777677,786697,866087,
%U A245878 879667,880667,886987,899687,906707,909767,966997,990967,6069977,6096907,6097997,6678877
%N A245878 Primes p such that p - d and p + d are also primes, where d is the smallest nonzero digit of p.
%C A245878 Intersection of A245744 and A245745.
%C A245878 The smallest nonzero digit of a(n) is 6, and the least significant digit of a(n) is 7.
%H A245878 Robert Israel, <a href="/A245878/b245878.txt">Table of n, a(n) for n = 1..10000</a>
%e A245878 The prime 607 is in the sequence because 607 - 6 = 601 and 607 + 6 = 613 are both primes.
%p A245878 f:= proc(x) local L,i,y;
%p A245878    L:= subs(1=6,2=7,3=8,4=9, convert(x,base,5));
%p A245878    if not member(6,L) then return NULL fi;
%p A245878    y:= add(L[i]*10^(i-1),i=1..nops(L));
%p A245878    if isprime(y) and isprime(y-6) and isprime(y+6) then y else NULL fi
%p A245878 end proc:
%p A245878 map(f, [seq(2+5*k,k=1..10000)]); # _Robert Israel_, Nov 25 2024
%t A245878 pdQ[p_]:=Module[{c=Min[DeleteCases[IntegerDigits[p],0]]},AllTrue[p+{c,-c},PrimeQ]]; Select[Prime[Range[460000]],pdQ] (* _Harvey P. Dale_, Feb 26 2023 *)
%o A245878 (PARI) s=[]; forprime(p=2, 7000000, v=vecsort(digits(p),,8); d=v[1+!v[1]]; if(isprime(p-d) && isprime(p+d), s=concat(s, p))); s
%o A245878 (Python)
%o A245878 from sympy import isprime
%o A245878 from sympy import prime
%o A245878 for n in range(1, 10**6):
%o A245878   s=prime(n)
%o A245878   lst = []
%o A245878   for i in str(s):
%o A245878     if i != '0':
%o A245878       lst.append(int(i))
%o A245878   if isprime(s+min(lst)) and isprime(s-min(lst)):
%o A245878     print(s, end=', ')
%o A245878 # _Derek Orr_, Aug 13 2014
%Y A245878 Cf. A245742, A245743, A245744, A245745, A245877.
%K A245878 nonn,base,look
%O A245878 1,1
%A A245878 _Colin Barker_, Aug 05 2014