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

A215471 Numbers k such that in a rotated-square spiral with positive integers (A215468) among k's eight nearest neighbors five or more are primes.

Original entry on oeis.org

8, 30, 138, 658, 2620, 3010, 3168, 3372, 3462, 8628, 11940, 17682, 24918, 27918, 32560, 39228, 39790, 40128, 43608, 48532, 53268, 55372, 56040, 56712, 73362, 85200, 85888, 90646, 96052, 101748, 102652, 104382, 112068, 113932, 115330, 119298, 128518, 129288, 131500
Offset: 1

Views

Author

Alex Ratushnyak, Aug 11 2012

Keywords

Examples

			Spiral begins:
                            113
                        112  85  86
                    111  84  61  62  87
                110  83  60  41  42  63  88
            109  82  59  40  25  26  43  64  89
        108  81  58  39  24  13  14  27  44  65  90
    107  80  57  38  23  12   5   6  15  28  45  66  91
106  79  56  37  22  11   4   1   2   7  16  29  46  67  92
    105  78  55  36  21  10   3   8  17  30  47  68  93
        104  77  54  35  20   9  18  31  48  69  94
            103  76  53  34  19  32  49  70  95
                102  75  52  33  50  71  96
                    101  74  51  72  97
                        100  73  98
                             99
Among eight nearest neighbors of 30 five are primes: 7, 17, 31, 29, 47.
		

Crossrefs

Programs

  • Python
    SIZE = 3335  # must be odd
    TOP = SIZE*SIZE
    t = TOP//2
    prime = [1]*t
    prime[1]=0
    for i in range(4,t,2):
        prime[i]=0
    for i in range(3,t,2):
        if prime[i]==1:
            for j in range(i*3,t,i*2):
                prime[j]=0
    grid = [0] * TOP
    posX = posY = SIZE//2
    saveX = [0]* (t+1)
    saveY = [0]* (t+1)
    grid[posY*SIZE+posX] = 1
    saveX[1]=posX
    saveY[1]=posY
    posX += 1
    grid[posY*SIZE+posX] = 2
    saveX[2]=posX
    saveY[2]=posY
    n = 3
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        saveX[n]=posX
        saveY[n]=posY
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX!=SIZE-1:
        walk(-1,  1, -1, -1)    # down-left
        walk(-1, -1,  1, -1)    # up-left
        walk( 1, -1,  1,  0)    # up-right
        walk( 1,  0,  1,  1)    # right
        walk( 1,  1, -1,  1)    # down-right
    for s in range(1, n):
        posX = saveX[s]
        posY = saveY[s]
        a,b=(grid[(posY-1)*SIZE+posX-1]) , (grid[(posY-1)*SIZE+posX+1])
        c,d=(grid[(posY+1)*SIZE+posX-1]) , (grid[(posY+1)*SIZE+posX+1])
        e,f=(grid[(posY-1)*SIZE+posX  ]) , (grid[(posY+1)*SIZE+posX  ])
        g,h=(grid[ posY   *SIZE+posX-1]) , (grid[ posY   *SIZE+posX+1])
        if a*b==0 or c*d==0 or e*f==0 or g*h==0:
            break
        z = prime[a]+prime[b]+prime[c]+prime[d]
        if z+prime[e]+prime[f]+prime[g]+prime[h] >= 5:
            print(s, end=' ')
    
  • Python
    # See A215468 for the definition of spiral().
    from sympy import isprime
    def neighbors(n):
        x = A010751(n-1)
        y = A305258(n-1)
        return [spiral(x+i, y+j) for i in (-1, 0, 1) for j in (-1, 0, 1) if (i, j) != (0, 0)]
    def is_A215471(n): return sum(map(isprime, neighbors(n))) >= 5 # David Radcliffe, Aug 05 2025

A217015 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of rotated-square spiral (defined in A215468).

Original entry on oeis.org

1, 5, 6, 2, 8, 3, 10, 4, 12, 24, 13, 14, 27, 15, 7, 17, 31, 18, 9, 20, 35, 21, 11, 23, 39, 59, 40, 25, 26, 43, 64, 44, 28, 16, 30, 48, 70, 49, 32, 19, 34, 53, 76, 54, 36, 22, 38, 58, 82, 110, 83, 60, 41, 42, 63, 88, 117, 89, 65, 45, 29, 47, 69, 95, 125, 96, 71, 50
Offset: 1

Views

Author

Alex Ratushnyak, Sep 23 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 33       # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    posX += 1
    grid[posY*SIZE+posX]=2
    n = 3
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX!=SIZE-1:
        walk(-1,  1, -1, -1)    # down-left
        walk(-1, -1,  1, -1)    # up-left
        walk( 1, -1,  1,  0)    # up-right
        walk( 1,  0,  1,  1)    # right
        walk( 1,  1, -1,  1)    # down-right
    import sys
    grid2 = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid2[posY*SIZE+posX]=1
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            sys.exit(1)
        print(a, end=', ')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk2(0, -1, 1, 0)    # up
        walk2(1, 0, 0, 1)     # right
        walk2(0, 1, -1, 0)    # down
        walk2(-1, 0, 0, -1)   # left

A217296 Permutation of natural numbers arising from applying the walk of rotated-square spiral (defined in A215468) to the data of square spiral (e.g. A214526).

Original entry on oeis.org

1, 4, 6, 8, 2, 3, 15, 5, 19, 7, 23, 9, 11, 12, 14, 34, 16, 18, 40, 20, 22, 46, 24, 10, 28, 29, 13, 33, 61, 35, 17, 39, 69, 41, 21, 45, 77, 47, 25, 27, 53, 54, 30, 32, 60, 96, 62, 36, 38, 68, 106, 70, 42, 44, 76, 116, 78, 48, 26, 52, 86, 87, 55, 31, 59, 95, 139
Offset: 1

Views

Author

Alex Ratushnyak, Sep 30 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 29    # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    n = 2
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX:
        walk(0, -1, 1, 0)    # up
        walk(1, 0, 0, 1)     # right
        walk(0, 1, -1, 0)    # down
        walk(-1, 0, 0, -1)   # left
    grid2 = [0] * (SIZE*SIZE)
    posY = SIZE//2
    posX = posY+1
    grid2[posY*SIZE+posX-1] = grid2[posY*SIZE+posX] = 1
    print(1, end=',')
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            raise ValueError
        print(a, end=',')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX!=SIZE-1:
        walk2(-1,  1, -1, -1)    # down-left
        walk2(-1, -1,  1, -1)    # up-left
        walk2( 1, -1,  1,  0)    # up-right
        walk2( 1,  0,  1,  1)    # right
        walk2( 1,  1, -1,  1)    # down-right

A225590 Primes p such that A217015(p) is a prime number. That is, when applying the walk of a square spiral to the data of rotated-square spiral, on step p a prime number is hit.

Original entry on oeis.org

2, 11, 17, 23, 53, 61, 67, 139, 149, 151, 163, 251, 263, 269, 281, 397, 421, 431, 541, 547, 557, 607, 619, 743, 773, 809, 1021, 1039, 1229, 1279, 1291, 1303, 1361, 1553, 1601, 1619, 1637, 1871, 1901, 1949, 2003, 2239, 2251, 2267, 2281, 2287, 2309, 2311, 2347, 2381, 2393
Offset: 1

Views

Author

Alex Ratushnyak, May 15 2013

Keywords

Comments

Corresponding primes with prime indices, in sorted order: A225754.

Crossrefs

A225754 Primes p such that A217296(p) is a prime number. That is, when applying the walk of rotated-square spiral to the data of square spiral, on step p a prime number is hit.

Original entry on oeis.org

5, 11, 13, 29, 31, 41, 67, 71, 73, 79, 127, 137, 193, 199, 211, 293, 313, 421, 499, 503, 619, 631, 647, 661, 673, 773, 811, 967, 991, 1013, 1129, 1163, 1553, 1567, 1597, 1601, 1607, 1747, 1777, 1783, 1789, 1801, 1831, 1861, 1997, 2039, 2053, 2087, 2099, 2113, 2287, 2311
Offset: 1

Views

Author

Alex Ratushnyak, May 15 2013

Keywords

Comments

Corresponding primes with prime indices, in sorted order: A225590. The intersection of a(n) with A225590 begins: 11, 67, 421, 619, 773, 1553, 1601, 2287, 2311, 2381, 2609, 3169, 3181, 3491, 3511, 4157, 4597, 4639, 6263, 7129, 7177, 7193, 8291, 9277.

Crossrefs

Showing 1-5 of 5 results.