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.

A375965 Primes which can be turned into a different prime by exchanging two consecutive digits.

Original entry on oeis.org

13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 131, 137, 139, 149, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 349, 373, 379, 389, 397, 401, 419, 421, 439, 457, 461, 463, 467, 491, 503
Offset: 1

Views

Author

Matthew House, Sep 04 2024

Keywords

Comments

Heuristically, both this sequence and its complement should have positive density within the primes. Empirically, n/pi(a(n)) approaches ~0.75 for large n. But is this sequence even infinite?
Dickson's conjecture implies it is infinite, e.g. it implies that there are infinitely many primes ending in 13 for which changing the last two digits to 31 produces a prime. - Robert Israel, Sep 04 2024

Examples

			2, 3, 5, and 7 are excluded, since they have no two digits to exchange.
11 is excluded, since it yields only itself.
13 and 17 are included, since they yield the primes 31 and 71.
19, 23, and 29 are excluded, since they yield the composite numbers 91, 32, and 92.
		

Crossrefs

Subsequence of A225035.

Programs

  • Maple
    filter:= proc(n) local L,d,i;
      if not isprime(n) then return false fi;
      L:= convert(n,base,10); d:= nops(L);
      for i from 1 to d-1 do
          if L[i] <> L[i+1] and isprime(n + (L[i]-L[i+1])*(10^i-10^(i-1))) then return true fi
      od;
      false
    end proc:
    select(filter, [seq(i,i=11 .. 1---,2)]); # Robert Israel, Sep 04 2024
  • Mathematica
    Select[Prime[Range[100]], With[{digits = IntegerDigits[#]}, AnyTrue[Complement[FromDigits[Permute[digits, Cycles[{{#, # + 1}}]]] & /@ Range[Length[digits] - 1], {#}], PrimeQ]] &]
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        s = str(n)
        for i in range(len(s)-1):
            t = int(s[:i]+s[i+1]+s[i]+s[i+2:])
            if t != n and isprime(t): return True
        return False
    print([k for k in range(504) if ok(k)]) # Michael S. Branicky, Sep 04 2024