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!)
A158641 Strong primes p: adding 2 to any one digit of p produces a prime number (no digits 8 & 9 in p) 0
3, 5, 11, 17, 41, 107, 137, 347, 2111, 2657, 3527, 4421, 6761, 21011, 24371, 32057 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
All terms are lesser of twin pairs.
The sequence is finite. In particular, there are no terms longer than 5 digits since 2*10^k for k=0,1,...,5 give all nonzero residues modulo 7, implying that adding 2 to some digit yields a multiple of 7. - Max Alekseyev, Apr 25 2010
LINKS
EXAMPLE
2111 is in this sequence because all 2111, 4111, 2311, 2131 and 2113 are prime numbers.
32057 is in this sequence because all 32057, 52057, 34057, 32257, 32077 and 32059 are prime numbers.
MAPLE
Lton := proc(L) local i; add(op(i, L)*10^(i-1), i=1..nops(L)) ; end: isA158641 := proc(p) local pdgs, pplus, i ; if isprime(p) then pdgs := convert(p, base, 10) ; if convert(pdgs, set) intersect {8, 9} <> {} then false; else for i from 1 to nops(pdgs) do pplus := subsop(i=2+op(i, pdgs), pdgs) ; if not isprime(Lton(pplus)) then RETURN(false); fi; od: true; fi; else false; fi; end: for n from 1 do p := ithprime(n) ; if isA158641(p) then print(p) ; fi; od: # R. J. Mathar, Apr 16 2009
MATHEMATICA
spQ[p_]:=Max[IntegerDigits[p]]<8&&AllTrue[FromDigits/@Table[MapAt[ 2+#&, IntegerDigits[ p], n], {n, IntegerLength[p]}], PrimeQ]; Select[Prime[ Range[ 3500]], spQ] (* Harvey P. Dale, Nov 26 2022 *)
PROG
(PARI) test(p)=my(v=eval(Vec(Str(p)))); for(i=1, #v, if(v[i]>7, return(0))); for(i=0, #v-1, if(!isprime(p+2*10^i), return(0))); 1
forprime(p=2, 4e9, if(isprime(p+2) && test(p), print1(p", "))) \\ Charles R Greathouse IV, Sep 09 2009
(PARI) has(n)=if(vecmax(Set(digits(n)))>7, return(0)); for(i=0, #digits(n)-1, if(!isprime(n+2*10^i), return(0))); 1
select(has, primes(3438)) \\ Charles R Greathouse IV, Mar 11 2016
CROSSREFS
Cf. A050249, A158124, A158125 Weakly prime numbers (changing any one digit always produces a composite number).
Sequence in context: A208572 A040176 A092873 * A019386 A283064 A154622
KEYWORD
nonn,full,fini,base
AUTHOR
Zak Seidov, Mar 23 2009
EXTENSIONS
Keywords full, fini from Max Alekseyev, Apr 25 2010
STATUS
approved

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 April 19 11:31 EDT 2024. Contains 371792 sequences. (Running on oeis4.)