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!)
A032734 All 81 combinations of prefixing and following a(n) by a single digit are nonprime. 7

%I #35 Sep 05 2022 08:58:56

%S 2437,5620,7358,11111,13308,13332,13650,14612,19737,19817,24217,25213,

%T 26302,27971,28472,28838,29289,29542,29650,31328,33027,33170,35914,

%U 35970,36186,37977,38327,39127,39608,40078,41165,41528,42422,43277,44657,45649,47172,47382

%N All 81 combinations of prefixing and following a(n) by a single digit are nonprime.

%H Robert Israel, <a href="/A032734/b032734.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Pri#piden">Index entries for primes involving decimal expansion of n</a>

%e 2437 prefixed and followed with a pair of digits from (1,2,3,4,5,6,7,8,9) never yields a prime, e.g., '9'2437'1' = 7 * 37 * 43 * 83.

%p isA032734 := proc(n)

%p for k from 1 to 9 do

%p for k2 from 1 to 9 do

%p dgs := [k,op(convert(n,base,10)),k2] ;

%p dgsn := add( op(i,dgs)*10^(i-1),i=1..nops(dgs)) ;

%p if isprime(dgsn) then

%p return false;

%p end if;

%p end do:

%p end do:

%p return true;

%p end proc:

%p for n from 1 to 50000 do

%p if isA032734(n) then

%p printf("%d,",n);

%p end if;

%p end do: # _R. J. Mathar_, Oct 22 2011

%p filter:= proc(n) local d,i,j;

%p d:= 10^(ilog10(n)+2);

%p not ormap(isprime,[seq(seq(d*i+10*n+j,j=[1,3,5,7,9]),i=1..9)])

%p end proc:

%p select(filter,[$1..10^5]); # _Robert Israel_, Jul 07 2016

%t ok[n_] := With[{id = IntegerDigits[n]}, Select[ Flatten[ Table[ FromDigits[ Join[{j}, id, {k}]], {j, 1, 9}, {k, 1, 9}], 1], PrimeQ, 1] == {}]; A032734 = {}; n = 1; While[n < 50000, If[ok[n], Print[n]; AppendTo[A032734, n]]; n++]; A032734(* _Jean-François Alcover_, Nov 23 2011 *)

%t Select[Range[50000],NoneTrue[Flatten[Table[FromDigits[Join[{x}, IntegerDigits[ #],{y}]],{x,9},{y,9}]],PrimeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Apr 07 2018 *)

%o (PARI) is_A032734(n)=p=10^#Str(n*=10);forstep(k=n+p,n+9*p,p,nextprime(k)>k+9 || return);1 \\ _M. F. Hasler_, Oct 22 2011

%o (Python)

%o from sympy import isprime

%o def ok(n):

%o s, fdigs, edigs = str(n), "123456789", "1379"

%o return not any(isprime(int(f+s+e)) for f in fdigs for e in edigs)

%o print([k for k in range(10**5) if ok(k)]) # _Michael S. Branicky_, Sep 05 2022

%Y Cf. A032682, A032683, A032684, A032685.

%Y CF. A032702-A032733.

%K nonn,nice,base

%O 1,1

%A _Patrick De Geest_, May 15 1998

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 May 6 07:22 EDT 2024. Contains 372290 sequences. (Running on oeis4.)