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

A341542 Numbers on the square spiral board that are enclosed by four primes.

Original entry on oeis.org

12, 72, 1152, 1452, 1950, 3672, 5520, 6660, 8232, 10302, 10890, 13218, 15288, 15360, 16062, 18042, 20898, 21018, 23628, 25998, 27918, 32190, 37812, 42018, 42462, 48858, 55818, 57192, 80832, 80910, 83340, 91368, 97848, 98640, 104472, 111492, 117498, 119550
Offset: 1

Views

Author

Ya-Ping Lu, Feb 13 2021

Keywords

Comments

This sequence is similar to A172294, in which the starting number of the square spiral is 0 instead of 1. For a(n) < 10000000, 4 out of the 782 terms in this sequence, 72, 10302, 415380 and 1624350 are absent in A172294, while 6 out of the 784 terms in A172294, 42, 23562, 83232, 205662, 5805690 and 7019850 are absent in this sequence.
Conjecture: This sequence is infinite. If the conjecture holds, then the twin prime conjecture is true.
The 4 neighbors of n in the spiral are A068225, A068226, A334751, and A334752. - Kevin Ryde, Feb 13 2021

Crossrefs

Programs

  • Python
    from sympy import isprime
    from math import sqrt, ceil
    m, m_max = 2, 1000000
    while m <= m_max:
        L = [0, 0, 0, 0]
        n = int(ceil((sqrt(m) + 1.0)/2.0))
        z1 = 4*n*n - 12*n + 10
        z2 = 4*n*n - 10*n + 7
        z3 = 4*n*n - 8*n + 5
        z4 = 4*n*n - 6*n + 3
        z5 = 4*n*n - 4*n + 1
        if m > z1 and m < z2: L = [m + 1, m - 8*n + 15, m - 1, m + 8*n - 7]
        elif m > z2 and m < z3: L = [m + 8*n - 5, m + 1, m - 8*n + 13, m - 1]
        elif m > z3 and m < z4: L = [m - 1, m + 8*n - 3, m + 1, m - 8*n + 11]
        elif m > z4 and m < z5: L = [m - 8*n + 9, m - 1, m + 8*n - 1, m + 1]
        if isprime(L[0]) == 1 and isprime(L[1]) == 1 and isprime(L[2]) == 1 and isprime(L[3]) == 1: print(m)
        m += 2

A341672 a(n) is the number of numbers on the square spiral board such that it takes n steps for them to reach square 1 along the shortest path without stepping on any prime number.

Original entry on oeis.org

1, 4, 7, 5, 9, 8, 12, 10, 14, 23, 29, 32, 35, 38, 46, 47, 52, 59, 65, 64, 67, 76, 78, 84, 90, 91, 94, 100, 106, 110, 111, 110, 119, 126, 131, 137, 139, 138, 143, 153, 154, 144, 152, 144, 152, 156, 170, 195, 193, 193, 192, 198, 203, 215, 215, 209, 216, 222, 225
Offset: 0

Views

Author

Ya-Ping Lu, Feb 17 2021

Keywords

Comments

a(n) is the number of terms in A341541 whose value equals n.
If stepping on prime squares is permitted, a(n) = 4*n. Conjecture: lim_{n->oo} a(n)/n = 4.

Crossrefs

Programs

  • Python
    from sympy import prime, isprime
    from math import sqrt, ceil
    def neib(m):
        if m == 1: L = [4, 6, 8, 2]
        else:
            n = int(ceil((sqrt(m) + 1.0)/2.0))
            z1 = 4*n*n - 12*n + 10; z2 = 4*n*n - 10*n + 7; z3 = 4*n*n - 8*n + 5; z4 = 4*n*n - 6*n + 3; z5 = 4*n*n - 4*n + 1
            if m == z1:             L = [m + 1, m - 1, m + 8*n - 9, m + 8*n - 7]
            elif m > z1 and m < z2: L = [m + 1, m - 8*n + 15, m - 1, m + 8*n - 7]
            elif m == z2:           L = [m + 8*n - 5, m + 1, m - 1, m + 8*n - 7]
            elif m > z2 and m < z3: L = [m + 8*n - 5, m + 1, m - 8*n + 13, m - 1]
            elif m == z3:           L = [m + 8*n - 5, m + 8*n - 3, m + 1, m - 1]
            elif m >z3 and m < z4:  L = [m - 1, m + 8*n - 3, m + 1, m - 8*n + 11]
            elif m == z4:           L = [m - 1, m + 8*n - 3, m + 8*n - 1, m + 1]
            elif m > z4 and m < z5: L = [m - 8*n + 9, m - 1, m + 8*n - 1, m + 1]
            elif m == z5:           L = [m - 8*n + 9, m - 1, m + 8*n - 1, m + 1]
        return L
    print(1)
    L_1 = [1]; L_in = [1]; step_max = 100
    for step in range(1, step_max + 1):
        L = []
        for j in range(0, len(L_1)):
            m = L_1[j]
            if isprime(m) == 0:
                for k in range(4):
                    m_k = neib(m)[k]
                    if m_k not in L_in: L.append(m_k); L_in.append(m_k)
        print(len(L))
        L_1 = L

A341770 Largest number m on the square spiral board such that it takes n steps to reach square 1 from square m along the shortest path without stepping on any prime number.

Original entry on oeis.org

1, 8, 23, 34, 61, 62, 97, 138, 189, 248, 315, 390, 473, 564, 663, 770, 885, 1008, 1139, 1278, 1425, 1580, 1743, 1914, 2093, 2280, 2475, 2678, 2889, 3108, 3335, 3570, 3813, 4064, 4323, 4590, 4865, 5148, 5439, 5738, 6045, 6360, 6683, 7014, 7353, 7700, 8055, 8418
Offset: 0

Views

Author

Ya-Ping Lu, Feb 19 2021

Keywords

Comments

If stepping on prime squares is permitted, a(n) = 4*n^2 + 3*n + 1.
For n >= 7, a(n) = 4*n^2 - 9*n + 5 = 4*(n-1)^2 - (n-1), which is A033991(n-1).

Crossrefs

Programs

  • Python
    from sympy import prime, isprime
    from math import sqrt, ceil
    def neib(m):
        if m == 1: L = [4, 6, 8, 2]
        else:
            n = int(ceil((sqrt(m) - 1.0)/2.0))
            z1 = 4*n*n - 4*n + 2; z2 = 4*n*n - 2*n + 1; z3 = 4*n*n + 1
            z4 = 4*n*n + 2*n + 1; z5 = 4*n*n + 4*n + 1;
            if m == z1:             L = [m + 1, m - 1, m + 8*n - 1, m + 8*n + 1]
            elif m > z1 and m < z2: L = [m + 1, m - 8*n + 7, m - 1, m + 8*n + 1]
            elif m == z2:           L = [m + 8*n + 3, m + 1, m - 1, m + 8*n + 1]
            elif m > z2 and m < z3: L = [m + 8*n + 3, m + 1, m - 8*n + 5, m - 1]
            elif m == z3:           L = [m + 8*n + 3, m + 8*n + 5, m + 1, m - 1]
            elif m >z3 and m < z4:  L = [m - 1, m + 8*n + 5, m + 1, m - 8*n + 3]
            elif m == z4:           L = [m - 1, m + 8*n + 5, m + 8*n + 7, m + 1]
            elif m > z4 and m < z5: L = [m - 8*n + 1, m - 1, m + 8*n + 7, m + 1]
            elif m == z5:           L = [m - 8*n + 1, m - 1, m + 8*n + 7, m + 1]
        return L
    print(1)
    L_1 = [1]; L_in = [1]; step_max = 60
    for step in range(1, step_max + 1):
        L = []
        for j in range(0, len(L_1)):
            m = L_1[j]
            if isprime(m) == 0:
                for k in range(4):
                    m_k = neib(m)[k]
                    if m_k not in L_in: L.append(m_k); L_in.append(m_k)
        print(max(L))
        L_1 = L
Showing 1-3 of 3 results.