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-2 of 2 results.

A352942 Let p = prime(n); a(n) = number of primes q with same number of binary digits as p that can be obtained from p by changing one binary digit.

Original entry on oeis.org

1, 1, 1, 1, 0, 0, 1, 2, 2, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 3, 1, 1, 1, 1, 2, 3, 2, 0, 1, 1, 0, 2, 1, 2, 3, 1, 1, 4, 1, 0, 1, 1, 0, 1, 3, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 2, 2, 0, 3, 2, 1, 1, 2, 2, 1, 1, 0, 3, 0, 0, 2, 2, 0, 2, 2, 2, 3, 2, 2, 0, 2, 0, 1, 2, 0, 1
Offset: 1

Views

Author

Michael S. Branicky, May 11 2022

Keywords

Comments

a(n) is also the degree of prime(n) in the graph P(A070939(prime(n)), 2), defined in A145667.

Examples

			prime(1) = 2, in binary 10, has one neighbor 11 in P(2, 2), so a(1) = 1.
prime(14) = 43, in binary 101011, has neighbors 101001 (41), 101111 (47), 111011 (59), so a(14) = 3.
		

Crossrefs

Programs

  • Maple
    a:= n-> (p-> nops(select(isprime, {seq(Bits[Xor]
            (p, 2^i), i=0..ilog2(p)-1)})))(ithprime(n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, May 11 2022
  • Mathematica
    A352942[n_] := Count[BitXor[#, 2^Range[0, BitLength[#] - 2]], _?PrimeQ] & [Prime[n]];
    Array[A352942, 100] (* Paolo Xausa, Apr 23 2025 *)
  • Python
    from sympy import isprime, sieve
    def neighs(s):
        digs = "01"
        ham1 = (s[:i]+d+s[i+1:] for i in range(len(s)) for d in digs if d!=s[i])
        yield from (h for h in ham1 if h[0] != '0')
    def a(n):
        return sum(1 for s in neighs(bin(sieve[n])[2:]) if isprime(int(s, 2)))
    print([a(n) for n in range(1, 88)])

Formula

a(n) = deg(prime(n)) in P(A070939(prime(n)), 2) (see A145667).

A353737 Length of longest n-digit optimal prime ladder (base 10).

Original entry on oeis.org

2, 4, 7, 9, 11, 13, 15
Offset: 1

Views

Author

Michael S. Branicky, May 09 2022

Keywords

Comments

A prime ladder (in base b) starts with a prime, ends with a prime, and each step produces a new prime by changing exactly one base-b digit.
A shortest such construct between two given primes is optimal.
Analogous to a word ladder (see Wikipedia link).
Here, n-digit primes do not allow leading 0 digits.
If all n-digit primes are disconnected, a(n) = 1; if there are no n-digit primes, a(n) = 0.
a(7) >= 15.
It follows from Bertrand's postulate that there exist n-digit primes for all n >= 1, so a(n) is never 0. - Pontus von Brömssen, May 11 2022

Examples

			The 1-digit optimal prime ladder 3 - 5 is tied for the longest amongst 1-digit primes, so a(1) = 2.
The 2-digit optimal prime ladder 97 - 17 - 13 - 53 is tied for the longest amongst 2-digit primes, so a(2) = 4.
The 3-digit optimal prime ladder 389 - 383 - 283 - 281 - 251 - 751 - 761 is tied for the longest amongst 3-digit primes, so a(3) = 7.
The 4-digit optimal prime ladder 4651 - 4951 - 4931 - 4933 - 4733 - 6733 - 6833 - 6883 - 6983 is tied for the longest amongst 4-digit primes, so a(4) = 9.
The 5-digit optimal prime ladder 88259 - 48259 - 45259 - 45959 - 41959 - 41969 - 91969 - 91961 - 99961 - 99761 - 99721 is tied for the longest amongst 5-digit primes, so a(5) = 13.
The 6-digit optimal prime ladder 440497 - 410497 - 410491 - 710491 - 710441 - 710443 - 717443 - 917443 - 917843 - 907843 - 905843 - 905833 - 995833 is tied for the longest amongst 6-digit primes, so a(6) = 13.
The 7-digit optimal prime ladder 3038459 - 3032459 - 3032453 - 3034453 - 3034457 - 3034657 - 3074657 - 3074557 - 4074557 - 4079557 - 4779557 - 4779547 - 7779547 - 7759547 - 7755547 is tied for the longest amongst 7-digit primes, so a(7) = 15. - _Michael S. Branicky_, May 21 2022
		

Crossrefs

Formula

a(n) is the number of vertices of a longest shortest path in the graph G = (V, E), where V = {n-digit base-10 primes} and E = {(v, w) | H_10(v, w) = 1}, where H_b is the Hamming distance in base b.

Extensions

a(7) from Michael S. Branicky, May 21 2022
Showing 1-2 of 2 results.