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.

A254756 Numbers such that all their proper hexadecimal prefixes and suffixes represent primes.

This page as a plain text file.
%I A254756 #22 May 22 2025 10:21:42
%S A254756 34,35,37,39,43,45,50,51,53,55,59,61,82,83,85,87,91,93,114,115,117,
%T A254756 119,123,125,178,179,181,183,187,189,210,211,213,215,219,221,595,661,
%U A254756 663,669,691,693,763,851,947,949,979,1333,1339,1341,1429
%N A254756 Numbers such that all their proper hexadecimal prefixes and suffixes represent primes.
%C A254756 A proper prefix (or suffix) of a number m is one which is neither void, nor identical to m.
%C A254756 Alternative definition: Slicing the hexadecimal expansion of a(n) in any way into two nonempty parts, each part represents a prime number.
%C A254756 Every proper hexadecimal prefix of each member a(n) must be a member of A237600. Since the latter is a finite sequence, a(n) is also finite. It has exactly 100 members, the largest of which is 39441303 (not a prime; the largest of the 16 primes occurring in this sequence is 3389).
%C A254756 The relation of a(n) to A237600 leads to the fastest way to reliably enumerate all its members.
%H A254756 Stanislav Sykora, <a href="/A254756/b254756.txt">Table of n, a(n) for n = 1..100</a>
%H A254756 Stanislav Sykora, <a href="https://oeis.org/wiki/File:GeneticThreads.txt">PARI/GP scripts for genetic threads</a>
%e A254756 13 is not a member because its expansion in base 16 (0xD) cannot be sliced in two. 33 (equal to 0x21) is also not a member because 1 is not a prime, while 34 (equal to 0x22) is a member because 2 is a prime.
%e A254756 1339, equal to 0x53B, is a member because all its proper hexadecimal prefixes and postfixes (0x5, 0x53, 0x3B, and 0xB) are prime.
%e A254756 The largest member is 0x259D397.
%o A254756 (PARI) \\ For the function GT_Trunc1 see A237600 and/or the link.
%o A254756 slicesIntoPrimes(n, b=10) = { \\ Same function as in A254751.
%o A254756 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 A254756 NumbersSlicingIntoPrimes(nmax,b=10) = {
%o A254756 my(rtp=GT_Trunc1(nmax,isprime,b)); \\ rtp right-truncatable primes
%o A254756 my(a=vector(b*#rtp),irtp,d,an,n=0);
%o A254756 for(irtp=1,#rtp, \\ For each rtp, append a digit and test
%o A254756    for(d=0,b-1,an=b*rtp[irtp]+d;
%o A254756      if(slicesIntoPrimes(an,b),n++;a[n]=an)););
%o A254756 return(a[1..n]);} v = NumbersSlicingIntoPrimes(1000000,16) \\ Call with nmax>>414,base 16
%o A254756 (Python)
%o A254756 from gmpy2 import is_prime
%o A254756 A254756_list = []
%o A254756 for n in range(16,10**6):
%o A254756     s = format(n,'x')
%o A254756     for i in range(1,len(s)):
%o A254756         if not (is_prime(int(s[i:],16)) and is_prime(int(s[:-i],16))):
%o A254756             break
%o A254756     else:
%o A254756         A254756_list.append(n) # _Chai Wah Wu_, Apr 16 2015
%Y A254756 Cf. A237600, A254751.
%K A254756 nonn,base,fini,full
%O A254756 1,1
%A A254756 _Stanislav Sykora_, Mar 05 2015