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.

A339080 Smaller members of binary Ormiston prime pairs: two consecutive primes whose binary representations are anagrams of each other.

Original entry on oeis.org

11, 23, 37, 59, 83, 103, 107, 131, 139, 151, 167, 173, 179, 199, 227, 229, 263, 277, 347, 409, 419, 439, 487, 491, 503, 557, 563, 613, 647, 653, 659, 683, 719, 727, 757, 811, 823, 827, 839, 853, 911, 941, 947, 953, 967, 997, 1019, 1063, 1091, 1093, 1123, 1163
Offset: 1

Views

Author

Amiram Eldar, Nov 22 2020

Keywords

Comments

Equivalently, the smaller of two consecutive primes with the same length of binary representation (A070939) and the same binary weight (A000120).

Examples

			11 is a term since 11 and 13 are consecutive primes whose binary representations, 1011 and 1101, are anagrams of each other.
		

Crossrefs

Cf. A000120, A069567 (decimal analog), A070939, A072274.

Programs

  • Mathematica
    Transpose[Select[Partition[Prime[Range[200]], 2, 1], Sort[IntegerDigits[First[#],2]] == Sort[IntegerDigits[Last[#],2]]&]][[1]] (* after Harvey P. Dale at A069567 *)
  • Python
    from sympy import nextprime
    from itertools import islice
    def hash(n): return "".join(sorted(bin(n)[2:]))
    def agen(start=2): # generator of terms
        p = nextprime(start-1); q=nextprime(p)
        hp, hq = list(map(hash, [p, q]))
        while True:
            if hp == hq: yield p
            p, q = q, nextprime(q)
            hp, hq = hq, hash(q)
    print(list(islice(agen(), 52))) # Michael S. Branicky, Feb 19 2024