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.

A375614 Lexicographically earliest infinite sequence of distinct nonnegative pairs of terms that interpenetrate to produce a prime number.

Original entry on oeis.org

0, 11, 3, 17, 2, 23, 6, 13, 1, 21, 4, 19, 7, 27, 5, 33, 8, 39, 103, 10, 153, 20, 107, 12, 131, 15, 109, 16, 111, 26, 113, 24, 101, 30, 119, 14, 123, 25, 117, 29, 141, 22, 127, 18, 133, 31, 129, 28, 121, 34, 169, 36, 137, 32, 167, 38, 147, 35, 171, 43, 157, 37, 9, 41, 149, 44, 159, 55, 139, 46, 151, 45, 163, 48, 173, 42, 143, 51, 187, 49, 177, 52, 183, 50, 161, 54, 179, 47, 189
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Aug 22 2024

Keywords

Comments

The term a(n) must always be exactly one digit longer or shorter than the term a(n+1).

Examples

			Interpenetrate a(1) = 0 and a(2) = 11 to form 101 (a prime number);
interpenetrate a(2) = 11 and a(3) = 3 to form 131 (a prime number);
interpenetrate a(3) = 3 and a(4) = 17 to form 137 (a prime number);
interpenetrate a(4) = 17 and a(5) = 2 to form 127 (a prime number);
interpenetrate a(5) = 2 and a(6) = 23 to form 223 (a prime number);
interpenetrate a(6) = 23 and a(7) = 6 to form 263 (a prime number);
interpenetrate a(7) = 6 and a(8) = 13 to form 163 (a prime number);
interpenetrate a(8) = 13 and a(9) = 1 to form 113 (a prime number);
(...)
interpenetrate a(18) = 39 and a(19) = 103 to form 13093 (a prime number);
(...)
interpenetrate a(167) = 277 and a(168) = 1009 to form 1207079 (a prime number); etc.
		

Crossrefs

Programs

  • Maple
    Q:= proc(a,b) local La, Lb, i;
      La:= convert(a,base,10);
      Lb:= convert(b,base,10);
      add(La[i]*10^(2*i-2),i=1..nops(La)) + add(Lb[i]*10^(2*i-1),i=1..nops(Lb))
    end proc:
    f:= proc(n) local d,x;
      d:= 1+ilog10(n);
      if n::odd then
        for x from 10^(d-2) to 10^(d-1) - 1 do
          if not(member(x,S)) and isprime(Q(n,x)) then return x fi
        od
      fi;
      for x from 10^d+1 to 10^(d+1) - 1 by 2 do
        if not(member(x,S)) and isprime(Q(x,n)) then return x fi
      od;
    FAIL
    end proc:
    R:= 0,11: S:= {0,11}: v:= 11:
    for i from 2 to 100 do
      v:= f(v);
      R:= R,v;
      S:= S union {v};
    od:
    R; # Robert Israel, Aug 22 2024
  • Python
    from sympy import isprime
    from itertools import islice
    def ip(s, t): return int("".join(x+v for x, v in zip(s, t))+s[-1])
    def agen(): # generator of terms
        seen, an, found = set(), 0, True
        while found:
            yield an
            seen.add(an)
            s = str(an)
            d, found = len(s), False
            if s[-1] in "1379" and d > 1:
                for k in range(10**(d-2), 10**(d-1)):
                    if k not in seen and isprime(ip(s, str(k))):
                        an, found = k, True
                        break
            if not found:
                for k in range(10**d, 10**(d+1)):
                    if k not in seen and isprime(ip(str(k), s)):
                        an, found = k, True
                        break
    print(list(islice(agen(), 90))) # Michael S. Branicky, Aug 22 2024