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.

Previous Showing 11-14 of 14 results.

A145671 a(n) = number of components of the graph P(n,3) (defined in Comments).

Original entry on oeis.org

1, 2, 4, 8, 15, 32, 88, 209, 539, 1403, 3698, 9962, 26447, 71579, 196590, 541473, 1501720, 4186566, 11737617, 33005599, 93296302
Offset: 1

Views

Author

W. Edwin Clark, Mar 17 2009

Keywords

Comments

Let H(n,b) be the Hamming graph whose vertices are the sequences of length n over the alphabet {0,1,...,b-1} with adjacency being defined by having Hamming distance 1. Let P(n,b) be the subgraph of H(n,b) induced by the set of vertices which are base b representations of primes with n digits (not allowing leading 0 digits).

Crossrefs

Extensions

a(11)-a(19) from Max Alekseyev, May 12 2011
a(20)-a(21) from Max Alekseyev, Dec 23 2024

A209252 Number of primes (excluding n) that may be generated by replacing any decimal digit of n with a digit from 0 to 9.

Original entry on oeis.org

4, 4, 3, 3, 4, 3, 4, 3, 4, 4, 4, 7, 5, 9, 4, 5, 4, 8, 4, 7, 2, 7, 3, 7, 2, 3, 2, 8, 2, 5, 2, 5, 3, 9, 2, 3, 2, 6, 2, 7, 3, 6, 4, 8, 3, 4, 3, 7, 3, 8, 2, 7, 3, 7, 2, 3, 2, 8, 2, 5, 2, 5, 3, 9, 2, 3, 2, 6, 2, 7, 3, 6, 4, 8, 3, 4, 3, 9, 3, 6, 2, 7, 3, 7, 2, 3, 2, 8, 2, 5, 1, 6, 2, 8, 1, 2, 1, 5, 1, 6, 4, 10, 5, 9, 4
Offset: 0

Views

Author

Michel Lagneau, Jan 14 2013

Keywords

Comments

I expect that the average value of a(n) is 45/log 100 if n is coprime to 10 and 0 otherwise. - Charles R Greathouse IV, Jan 14 2013
First occurrence of k = 0..27: 200, 90, 20, 2, 1, 12, 37, 11, 17, 13, 101, 109, 107, 177, 357, 1001, 1011, 10759, 13299, 11487, 42189, 113183, 984417, 344253, 1851759, 4787769, 16121457, 15848679. - Robert G. Wilson v, Dec 19 2015
The number of prime neighbors of n in H(A055642(n), 10), where H(k,b) is the Hamming graph whose vertices are the sequences of length k over the alphabet {0,1,...,b-1} with adjacency being defined by having Hamming distance 1 (see A158576). - Michael S. Branicky, Apr 22 2025

Examples

			a(0) = 4 because by replacing the digit 0, we obtain the 4 primes 2, 3, 5 and 7;
a(11) = 7 because by replacing the 1st digit of *1, we obtain the primes 31, 41, 61, 71, and by replacing the 2nd digit of 1* we obtain the primes 13, 17, 19, hence a(11) = 7.
a(13) = 8 because 03, 11, 17, 19, 23, 43, 53, 73 and 83 are all primes.
a(204) = 0 because it is impossible to find a prime number if we replace the digits 2, 0 or 4.
		

Crossrefs

Programs

  • Maple
    A209252 := proc(n)
        local a,dgs,d,r,pd,p ;
        a := 0 ;
        dgs := convert(n,base,10) ;
        for d from 1 to nops(dgs) do
            for r from 0 to 9 do
                pd := subsop(d=r,dgs) ;
                p := add(op(i,pd)*10^(i-1),i=1..nops(pd)) ;
                if isprime(p) and p <> n then
                    a := a+1 ;
                end if;
            end do:
        end do:
        a ;
    end proc: # R. J. Mathar, Jan 18 2013
  • Mathematica
    f[n_] := Block[{c = k = 0, d, p, lmt = 1 + Floor@ Log10@ n}, While[k < lmt, d = 0; While[d < 10, p = Quotient[n, 10^(k+1)]*10^(k+1) + d*10^k + Mod[n, 10^k]; If[p != n && PrimeQ@ p, c++]; d++]; k++]; c]; f[0] = 4; Array[f, 105, 0] (* Robert G. Wilson v, Dec 19 2015 *)
  • Python
    from sympy import isprime
    def A209252(n):
        return len([1 for i in range(len(str(n))) for d in '0123456789' if d != str(n)[i] and isprime(int(str(n)[:i]+d+str(n)[i+1:]))]) # Chai Wah Wu, Sep 19 2016
    
  • Python
    from gmpy2 import digits, is_prime
    def a(n):
        s, c = list(map(int, digits(n))), 0
        if len(s) > 1 and s[-1] not in {1, 3, 7, 9}:
            z = int(is_prime(s[-1])) if all(c == 0 for c in s[1:-1]) else 0
            return z + sum(1 for e in {1, 3, 7, 9} if is_prime(n + e - s[-1]))
        for i in range(len(s)):
            b = 10**(len(s)-1-i)
            for j in range(10):
                if j != s[i]:
                    t = n + (j-s[i])*b
                    if is_prime(t):
                        c += 1
        return c
    print([a(n) for n in range(100)]) # Michael S. Branicky, Apr 22 2025

A253269 Weakly Twin Primes in base 10: Can only reach one other prime by single-decimal-digit changes.

Original entry on oeis.org

89391959, 89591959, 519512471, 519512473, 531324041, 561324041, 699023791, 699023891, 874481011, 874487011, 1862537503, 2232483271, 2232483871, 2608559351, 3127181789, 3157181789, 3928401949, 3928401989, 4070171669, 4070171969, 5225628323, 5309756339, 5525628323
Offset: 1

Views

Author

Michael Kleber, May 01 2015

Keywords

Comments

Each pair of twins here form a size-two connected component in the graph considered in A158576.
A naive heuristic argument based on the density of primes claims that this sequence should be infinite, and in fact that a positive proportion of all primes should have this property. A prime p has 9*log_10(p) neighbors, each prime with "probability" 1/log(p), and with all the other 2*9*log_10(p) neighbors being composite with "probability" (1-1/log(p))^(2*9*log_10(p)). For a large prime p, this goes to the limit 9/(exp(18/log(10))*log(10)), or about 0.16%. The fact that base-10 primes need to end with digit 1/3/7/9 will change the value of this probability, but won't change the fact that it is nonzero.
This is analogous to a theorem about weakly prime numbers; see the Terence Tao paper referenced in A050249.

Crossrefs

Programs

  • Mathematica
    NeighborsAndSelf[n_] := Flatten[MapIndexed[Table[ n + (i - #)*10^(#2[[1]] - 1), {i, 0, 9}] &, Reverse[IntegerDigits[n, 10]]]]
    PrimeNeighbors[n_] := Complement[Select[NeighborsAndSelf[n],PrimeQ],{n}]
    WeaklyTwinPrime[p_] := (Length[#] == 1 && PrimeNeighbors[#[[1]]] == {p}) &[PrimeNeighbors[p]]
    For[k = 0, k <= PrimePi[10^10], k++, If[WeaklyTwinPrime[Prime[k]], Print[Prime[k]]]]

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
Previous Showing 11-14 of 14 results.