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!)
A254751 Numbers such that, in base 10, all their proper prefixes and suffixes represent primes. 7

%I #33 Feb 13 2024 16:03:36

%S 22,23,25,27,32,33,35,37,52,53,55,57,72,73,75,77,237,297,313,317,373,

%T 537,597,713,717,737,797,2337,2397,2937,3113,3137,3173,3797,5937,5997,

%U 7197,7337,7397,29397,31373,37937,59397,73313,739397

%N Numbers such that, in base 10, all their proper prefixes and suffixes represent primes.

%C A proper prefix (or suffix) of a number m is one which is neither void, nor identical to m.

%C Alternative definition: Slicing the decimal expansion of a(n) in any way into two nonempty parts, each part represents a prime number.

%C Every proper prefix of each member a(n) is a member of A024770, and every proper suffix is a member of A024785. Since these are finite sequences, a(n) is also finite. It has 45 members, the largest of which is 739397 and happens to be a prime.

%C The sequence is a union of A254753 and A020994.

%C A subsequence of A260181. - _M. F. Hasler_, Sep 16 2016

%e 6 is not a member because its expansion cannot be sliced in two.

%e 597 is a member because (5,97,59, and 7) are all primes.

%e 2331 is excluded because 233 is prime, but 1 is not. - _Gordon Hamilton_, Feb 20 2015

%t fQ[n_] := (p = {2, 3, 5, 7}; If[ Union@ Join[p, {Mod[n, 10]}] != p, {False}, Block[{idn = IntegerDigits@ n, lng = Floor@ Log10@ n}, Union@ PrimeQ@ Flatten@ Table[{FromDigits[ Take[idn, i]], FromDigits[ Take[idn, -lng + i - 1]]}, {i, lng}] == {True}]]); Select[ Range@1000000, fQ] (* _Robert G. Wilson v_, Feb 21 2015 *)

%t Select[Range[10,750000],AllTrue[Flatten[Table[FromDigits/@TakeDrop[IntegerDigits[#],n],{n,IntegerLength[#]-1}]],PrimeQ]&] (* _Harvey P. Dale_, Feb 13 2024 *)

%o (PARI) slicesIntoPrimes(n,b=10) = {my(k=b);if(n<b,return(0););while(n\k>0,if(!isprime(n\k)||!isprime(n%k),return(0););k*=b;);return(1);}

%o (Sage)

%o def breakIntoPrimes(n):

%o D=n.digits()

%o for i in [1..len(D)-1]:

%o if not(is_prime(sum(D[i:][j]*10^j for j in range(len(D[i:])))) and is_prime(sum(D[:i][j]*10^j for j in range(len(D[:i]))))):

%o return False

%o else:

%o continue

%o return True

%o [n for n in [10..1000] if breakIntoPrimes(n)] # _Tom Edgar_, Feb 20 2015

%Y Cf. A020994, A024770, A024785, A254750, A254752, A254753, A254754, A254756.

%Y Cf. A260181.

%K nonn,base,fini,full

%O 1,1

%A _Stanislav Sykora_, Feb 15 2015

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 23 15:20 EDT 2024. Contains 371916 sequences. (Running on oeis4.)