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.

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

This page as a plain text file.
%I A254751 #33 Feb 13 2024 16:03:36
%S A254751 22,23,25,27,32,33,35,37,52,53,55,57,72,73,75,77,237,297,313,317,373,
%T A254751 537,597,713,717,737,797,2337,2397,2937,3113,3137,3173,3797,5937,5997,
%U A254751 7197,7337,7397,29397,31373,37937,59397,73313,739397
%N A254751 Numbers such that, in base 10, all their proper prefixes and suffixes represent primes.
%C A254751 A proper prefix (or suffix) of a number m is one which is neither void, nor identical to m.
%C A254751 Alternative definition: Slicing the decimal expansion of a(n) in any way into two nonempty parts, each part represents a prime number.
%C A254751 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 A254751 The sequence is a union of A254753 and A020994.
%C A254751 A subsequence of A260181. - _M. F. Hasler_, Sep 16 2016
%e A254751 6 is not a member because its expansion cannot be sliced in two.
%e A254751 597 is a member because (5,97,59, and 7) are all primes.
%e A254751 2331 is excluded because 233 is prime, but 1 is not. - _Gordon Hamilton_, Feb 20 2015
%t A254751 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 A254751 Select[Range[10,750000],AllTrue[Flatten[Table[FromDigits/@TakeDrop[IntegerDigits[#],n],{n,IntegerLength[#]-1}]],PrimeQ]&] (* _Harvey P. Dale_, Feb 13 2024 *)
%o A254751 (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 A254751 (Sage)
%o A254751 def breakIntoPrimes(n):
%o A254751     D=n.digits()
%o A254751     for i in [1..len(D)-1]:
%o A254751         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 A254751             return False
%o A254751         else:
%o A254751             continue
%o A254751     return True
%o A254751 [n for n in [10..1000] if breakIntoPrimes(n)] # _Tom Edgar_, Feb 20 2015
%Y A254751 Cf. A020994, A024770, A024785, A254750, A254752, A254753, A254754, A254756.
%Y A254751 Cf. A260181.
%K A254751 nonn,base,fini,full
%O A254751 1,1
%A A254751 _Stanislav Sykora_, Feb 15 2015