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.

Showing 1-4 of 4 results.

A105184 Primes that can be written as concatenation of two primes in decimal representation.

Original entry on oeis.org

23, 37, 53, 73, 113, 137, 173, 193, 197, 211, 223, 229, 233, 241, 271, 283, 293, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 389, 397, 433, 523, 541, 547, 571, 593, 613, 617, 673, 677, 719, 733, 743, 761, 773, 797, 977, 1013, 1033, 1093
Offset: 1

Views

Author

Lekraj Beedassy, Apr 11 2005

Keywords

Comments

Primes that can be written as the concatenation of two distinct primes is the same sequence.
Number of terms < 10^n: 0, 4, 48, 340, 2563, 19019, 147249, ... - T. D. Noe, Oct 04 2010
The second prime cannot begin with the digit zero, else 307 would be the first additional term. - Michael S. Branicky, Sep 01 2024

Examples

			193 is in the sequence because it is the concatenation of the primes 19 and 3.
197 is in the sequence because it is the concatenation of the primes 19 and 7.
199 is not in the sequence because there is no way to break it into two substrings such that both are prime: neither 1 nor 99 is prime, and 19 is prime but 9 is not.
		

Crossrefs

Subsequence of A019549.

Programs

  • Mathematica
    searchMax = 10^4; Union[Reap[Do[p = Prime[i]; q = Prime[j]; n = FromDigits[Join[IntegerDigits[p], IntegerDigits[q]]]; If[PrimeQ[n], Sow[n]], {i, PrimePi[searchMax/10]}, {j, 2, PrimePi[searchMax/10^Ceiling[Log[10, Prime[i]]]]}]][[2, 1]]] (* T. D. Noe, Oct 04 2010 *)
    Select[Prime@Range@1000,
     MatchQ[IntegerDigits@#, {x__, y__} /;
        PrimeQ@FromDigits@{x} && First@{y} != 0 &&
    PrimeQ@FromDigits@{y}] &] (* Hans Rudolf Widmer, Nov 30 2024 *)
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        s = str(n)
        return any(s[i]!="0" and isprime(int(s[:i])) and isprime(int(s[i:])) for i in range(1, len(s)))
    print([k for k in range(1100) if ok(k)]) # Michael S. Branicky, Sep 01 2024

Extensions

Corrected and extended by Ray Chandler, Apr 16 2005
Edited by N. J. A. Sloane, May 03 2007
Edited by N. J. A. Sloane, to remove erroneous b-file, comments and Mma program, Oct 04 2010

A361530 Primes that can be written as the result of shuffling the decimal digits of two primes.

Original entry on oeis.org

23, 37, 53, 73, 113, 127, 131, 137, 139, 151, 157, 173, 179, 193, 197, 211, 223, 229, 233, 239, 241, 271, 283, 293, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 389, 397, 421, 431, 433, 457, 523, 541, 547, 571, 593, 613, 617, 631, 673, 677, 719
Offset: 1

Views

Author

Robert C. Lyons, Mar 14 2023

Keywords

Comments

Each term is essentially an element of the shuffle product of the decimal digits of two primes (possibly equal).

Examples

			37 and 73 are in the sequence because they are both the result of shuffling 3 and 7.
127 is in the sequence because it is the result of shuffling 2 and the digits of 17.
1193 is in the sequence because it is the result of shuffling the digits of 13 and the digits of 19.
163 is not in the sequence because it is not the result of shuffling the digits of two primes. 163 is the result of permuting the digits of 3 and 61; however, 163 contains the digits of 61 in the wrong order.
		

Crossrefs

Programs

  • Python
    import sympy
    def get_shuffle_product(list_1, list_2):
        shuffle_product = set()
        shuffle = []
        _get_shuffle_product(list_1, list_2, shuffle, shuffle_product)
        return shuffle_product
    def _get_shuffle_product(list_1, list_2, shuffle, shuffle_product):
        if len(list_1) == 0 and len(list_2) == 0:
            shuffle_product.add(tuple(shuffle))
            return
        else:
            if len(list_1) == 0:
                shuffle.append(list_2[0])
                _get_shuffle_product(list_1, list_2[1:], shuffle, shuffle_product)
                shuffle.pop()
            elif len(list_2) == 0:
                shuffle.append(list_1[0])
                _get_shuffle_product(list_1[1:], list_2, shuffle, shuffle_product)
                shuffle.pop()
            else:
                shuffle.append(list_1[0])
                _get_shuffle_product(list_1[1:], list_2, shuffle, shuffle_product)
                shuffle.pop()
                shuffle.append(list_2[0])
                _get_shuffle_product(list_1, list_2[1:], shuffle, shuffle_product)
                shuffle.pop()
    max_prime_index = 25 # one and two digit primes.
    max_element = 999
    prime_set = set()
    for p_index in range(1, max_prime_index+1):
        p = sympy.prime(p_index)
        for q_index in range(p_index, max_prime_index+1):
            q = sympy.prime(q_index)
            list_p = list(str(p))
            list_q = list(str(q))
            shuffle_product = get_shuffle_product(list_p, list_q)
            for s in shuffle_product:
                candidate = int(''.join(s))
                if sympy.isprime(candidate) and candidate <= max_element:
                    prime_set.add(candidate)
    print(sorted(prime_set))
    
  • Python
    from sympy import isprime
    from itertools import chain, combinations
    def powerset(s): # skipping empty set and entire set
        return chain.from_iterable(combinations(s, r) for r in range(1, len(s)))
    def ok(n):
        if not isprime(n): return False
        s = str(n)
        for indices in powerset(range(len(s))):
            t1 = "".join(s[i] for i in indices)
            t2 = "".join(s[i] for i in range(len(s)) if i not in indices)
            if t1[0] != "0" and t2[0] != "0" and isprime(int(t1)) and isprime(int(t2)):
                return True
    print([k for k in range(720) if ok(k)]) # Michael S. Branicky, Apr 16 2023

A083470 Smallest prime which is the concatenation of n distinct primes in increasing order.

Original entry on oeis.org

2, 23, 257, 2357, 235723, 23571143, 2357111371, 235711131767, 23571113172367, 2357111317192343, 235711131719233171, 23571113171923296797, 2357111317192329314189, 235711131719232931375979, 23571113171923293137414371, 2357111317192329313741436167
Offset: 1

Views

Author

Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 02 2003

Keywords

Comments

Perhaps the n-th term begins with the concatenation of the first (n-1) primes, except for n = 3.
The 9th, 11th, 12th, 13th, .... terms are other counterexamples to the above "conjecture". On the other hand, it seems almost sure that the n-th term starts with the concatenation of the first (n-2) primes. - M. F. Hasler, Mar 20 2011

Crossrefs

Extensions

More terms from David Wasserman, Nov 02 2004

A384726 a(n) is the least number that is both the product of n distinct primes and the concatenation of n distinct primes.

Original entry on oeis.org

2, 35, 273, 11235, 237615, 11237835, 1123317195, 111371237835, 11132343837615, 1113172923477615, 111317233377372295, 11131723677292413195, 1113172377671953734135, 111317192375336174123715
Offset: 1

Views

Author

Robert Israel, Jun 08 2025

Keywords

Comments

a(n) is odd for n >= 2, because a number whose last digit is 2 and second-last is odd is divisible by 4.

Examples

			a(4) = 11235 is a term because 11235 is the product of four distinct primes 3, 5, 7, 107 and the concatenation of four distinct primes 11, 2, 3, 5, and no smaller number works.
		

Crossrefs

Programs

  • Maple
    cdp:= proc(x, n, S)
      local i,y;
      if n = 1 then return (not(member(x,S)) and isprime(x)) fi;
      for i from 1 to ilog10(x)+2-n do
        y:= x mod 10^i;
        if member(y,S) or not isprime(y) then next fi;
        if procname((x-y)/10^i, n-1, S union {y}) then return true fi;
      od;
      false
    end proc:
    f:= proc(n) uses priqueue; local pq, t, p, x, i, L, v, Lp;
      initialize(pq);
      L:= [seq(ithprime(i), i=2..n+1)];
      v:= convert(L, `*`);
      insert([-v, L], pq);
      do
        t:= extract(pq);
        x:= -t[1];
        if cdp(x,n,{}) then return x fi;
        L:= t[2];
        p:= nextprime(L[-1]);
        for i from n to 1 by -1 do
          if i < n and L[i] <> prevprime(L[i+1]) then break fi;
          Lp:= [op(L[1..i-1]), op(L[i+1..n]), p];
          insert([-convert(Lp, `*`), Lp], pq)
      od od;
    end proc:
    f(1):= 2:
    map(f, [$1..9]);

Extensions

a(11)-a(14) from Jinyuan Wang, Jun 12 2025
Showing 1-4 of 4 results.