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

A174344 List of x-coordinates of point moving in clockwise square spiral.

Original entry on oeis.org

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

Views

Author

Nikolas Garofil (nikolas(AT)garofil.be), Mar 16 2010

Keywords

Comments

Also, list of x-coordinates of point moving in counterclockwise square spiral.
This spiral, in either direction, is sometimes called the "Ulam spiral", but "square spiral" is a better name. (Ulam looked at the positions of the primes, but of course the spiral itself must be much older.) - N. J. A. Sloane, Jul 17 2018
Graham, Knuth and Patashnik give an exercise and answer on mapping n to square spiral x,y coordinates, and back x,y to n. They start 0 at the origin and first segment North so their y(n) is a(n+1). In their table of sides, it can be convenient to take n-4*k^2 so the ranges split at -m, 0, m. - Kevin Ryde, Sep 16 2019

Examples

			Here is the beginning of the clockwise square spiral. Sequence gives x-coordinate of the n-th point.
.
  20--21--22--23--24--25
   |                   |
  19   6---7---8---9  26
   |   |           |   |
  18   5   0---1  10  27
   |   |       |   |   |
  17   4---3---2  11  28
   |               |   |
  16--15--14--13--12  29
                       |
  35--34--33--32--32--30
.
Given the offset equal to 1, a(n) gives the x-coordinate of the point labeled n-1 in the above drawing. - _M. F. Hasler_, Nov 03 2019
		

References

  • Ronald L. Graham, Donald E. Knuth, Oren Patashnik, Concrete Mathematics, Addison-Wesley, 1989, chapter 3, Integer Functions, exercise 40 page 99 and answer page 498.

Crossrefs

Cf. A180714. A268038 (or A274923) gives sequence of y-coordinates.
The (x,y) coordinates for a point sweeping a quadrant by antidiagonals are (A025581, A002262). - N. J. A. Sloane, Jul 17 2018
See A296030 for the pairs (A174344(n), A274923(n)). - M. F. Hasler, Oct 20 2019
The diagonal rays are: A002939 (2*n*(2*n-1): 0, 2, 12, 30, ...), A016742 = (4n^2: 0, 4, 16, 36, ...), A002943 (2n(2n+1): 0, 6, 20, 42, ...), A033996 = (4n(n+1): 0, 8, 24, 48, ...). - M. F. Hasler, Oct 31 2019

Programs

  • Julia
    function SquareSpiral(len)
        x, y, i, j, N, n, c = 0, 0, 0, 0, 0, 0, 0
        for k in 0:len-1
            print("$x, ") # or print("$y, ") for A268038.
            if n == 0
                c += 1; c > 3 && (c =  0)
                c == 0 && (i = 0; j =  1)
                c == 1 && (i = 1; j =  0)
                c == 2 && (i = 0; j = -1)
                c == 3 && (i = -1; j = 0)
                c in [1, 3] && (N += 1)
                n = N
            end
            n -= 1
            x, y = x + i, y + j
    end end
    SquareSpiral(75) # Peter Luschny, May 05 2019
    
  • Maple
    fx:=proc(n) option remember; local k; if n=1 then 0 else
    k:=floor(sqrt(4*(n-2)+1)) mod 4;
    fx(n-1) + sin(k*Pi/2); fi; end;
    [seq(fx(n),n=1..120)]; # Based on Seppo Mustonen's formula. - N. J. A. Sloane, Jul 11 2016
  • Mathematica
    a[n_]:=a[n]=If[n==0,0,a[n-1]+Sin[Mod[Floor[Sqrt[4*(n-1)+1]],4]*Pi/2]]; Table[a[n],{n,0,50}] (* Seppo Mustonen, Aug 21 2010 *)
  • PARI
    L=0; d=1;
    for(r=1,9,d=-d;k=floor(r/2)*d;for(j=1,L++,print1(k,", "));forstep(j=k-d,-floor((r+1)/2)*d+d,-d,print1(j,", "))) \\ Hugo Pfoertner, Jul 28 2018
    
  • PARI
    a(n) = n--; my(m=sqrtint(n),k=ceil(m/2)); n -= 4*k^2; if(n<0, if(n<-m, k, -k-n), if(nKevin Ryde, Sep 16 2019
    
  • PARI
    apply( A174344(n)={my(m=sqrtint(n-=1), k=m\/2); if(n < 4*k^2-m, k, 0 > n -= 4*k^2, -k-n, n < m, -k, n-3*k)}, [1..99]) \\ M. F. Hasler, Oct 20 2019
    
  • Python
    # Based on Kevin Ryde's PARI script
    import math
    def A174344(n):
        n -= 1
        m = math.isqrt(n)
        k = math.ceil(m/2)
        n -= 4*k*k
        if n < 0: return k if n < -m else -k-n
        return -k if n < m else n-3*k # David Radcliffe, Aug 04 2025

Formula

a(1) = 0, a(n) = a(n-1) + sin(floor(sqrt(4n-7))*Pi/2). For a corresponding formula for the y-coordinate, replace sin with cos. - Seppo Mustonen, Aug 21 2010 with correction by Peter Kagey, Jan 24 2016
a(n) = A010751(A037458(n-1)) for n>1. - William McCarty, Jul 29 2021

Extensions

Link corrected by Seppo Mustonen, Sep 05 2010
Definition clarified by N. J. A. Sloane, Dec 20 2012

A001752 Expansion of 1/((1+x)*(1-x)^5).

Original entry on oeis.org

1, 4, 11, 24, 46, 80, 130, 200, 295, 420, 581, 784, 1036, 1344, 1716, 2160, 2685, 3300, 4015, 4840, 5786, 6864, 8086, 9464, 11011, 12740, 14665, 16800, 19160, 21760, 24616, 27744, 31161, 34884, 38931, 43320, 48070, 53200, 58730, 64680, 71071, 77924, 85261
Offset: 0

Views

Author

Keywords

Comments

Define a unit column of a binary matrix to be a column with only one 1. a(n) = number of 3 X n binary matrices with 1 unit column up to row and column permutations (if offset is 1). - Vladeta Jovovic, Sep 09 2000
Generally, number of 3 X n binary matrices with k=0,1,2,... unit columns, up to row and column permutations, is the coefficient of x^k in 1/6*(Z(S_n; 5 + 3*x,5 + 3*x^2, ...) + 3*Z(S_n; 3 + x,5 + 3*x^2,3 + x^3,5 + 3*x^4, ...) + 2*Z(S_n; 2,2,5 + 3*x^3,2,2,5 + 3*x^6, ...)), where Z(S_n; x_1,x_2,...,x_n) is the cycle index of symmetric group S_n of degree n.
First differences of a(n) give number of minimal 3-covers of an unlabeled n-set that cover 4 points of that set uniquely (if offset is 4).
Transform of tetrahedral numbers, binomial(n+3,3), under the Riordan array (1/(1-x^2), x). - Paul Barry, Apr 16 2005
Equals triangle A152205 as an infinite lower triangular matrix * [1, 2, 3, ...]. - Gary W. Adamson, Feb 14 2010
With a leading zero, number of all possible octahedra of any size, formed when intersecting a regular tetrahedron by planes parallel to its sides and dividing its edges into n equal parts. - V.J. Pohjola, Sep 13 2012
With 2 leading zeros and offset 1, the sequence becomes 0,0,1,4,11,... for n=1,2,3,... Call this b(n). Consider the partitions of n into two parts (p,q) with p <= q. Then b(n) is the total volume of the family of rectangular prisms with dimensions p, |q - p| and |q - p|. - Wesley Ivan Hurt, Apr 14 2018
Conjecture: For n > 2, a(n-3) is the absolute value of the coefficient of the term [x^(n-2)] in the characteristic polynomial of an n X n square matrix M(n) defined as the n-th principal submatrix of the array A010751 whose general element is given by M[i,j] = floor((j - i + 1)/2). - Stefano Spezia, Jan 12 2022
Consider the following drawing of the complete graph on n vertices K_n: Vertices 1, 2, ..., n are on a straight line. Any pair of nonconsecutive vertices (i, j) with i < j is connected by a semicircle that goes above the line if i is odd, and below if i is even. With four leading zeros and offset 1, a(n) gives the number of edge crossings of the aforementioned drawing of K_n. - Carlo Francisco E. Adajar, Mar 17 2022

Examples

			There are 4 binary 3 X 2 matrices with 1 unit column up to row and column permutations:
  [0 0] [0 0] [0 1] [0 1]
  [0 0] [0 1] [0 1] [0 1]
  [0 1] [1 1] [1 0] [1 1].
For n=5, the numbers of the octahedra, starting from the smallest size, are Te(5)=35, Te(3)=10, and Te(1)=1, the sum being 46. Te denotes the tetrahedral number A000292. - _V.J. Pohjola_, Sep 13 2012
		

References

  • T. A. Saaty, The Minimum Number of Intersections in Complete Graphs, Proc. Natl. Acad. Sci. USA., 52 (1964), 688-690.

Crossrefs

Cf. A001753 (partial sums), A002623 (first differences), A158454 (signed column k=2), A169792 (binomial transform).

Programs

  • Magma
    [Floor(((n+3)^2-1)*((n+3)^2-3)/48): n in [0..40]]; // Vincenzo Librandi, Aug 15 2011
  • Maple
    A001752:=n->(3*(-1)^n+93+168*n+100*n^2+24*n^3+2*n^4)/96:
    seq(A001752(n), n=0..50); # Wesley Ivan Hurt, Apr 01 2015
  • Mathematica
    a = {1, 4}; Do[AppendTo[a, a[[n - 2]] + (n*(n + 1)*(n + 2))/6], {n, 3, 10}]; a
    (* Number of octahedra *) nnn = 100; Teo[n_] := (n - 1) n (n + 1)/6
    Table[Sum[Teo[n - nn], {nn, 0, n - 1, 2}], {n, 1, nnn}]
    (* V.J. Pohjola, Sep 13 2012 *)
    LinearRecurrence[{4,-5,0,5,-4,1},{1,4,11,24,46,80},50] (* Harvey P. Dale, Feb 07 2019 *)
  • PARI
    a(n)=if(n<0,0,((n+3)^2-1)*((n+3)^2-3)/48-if(n%2,1/16))
    
  • PARI
    a(n)=(n^4+12*n^3+50*n^2+84*n+46)\/48 \\ Charles R Greathouse IV, Sep 13 2012
    

Formula

a(n) = floor(((n+3)^2 - 1)*((n+3)^2 - 3)/48).
G.f.: 1/((1+x)*(1-x)^5).
a(n) - 2*a(n-1) + a(n-2) = A002620(n+2).
a(n) + a(n-1) = A000332(n+4).
a(n) - a(n-2) = A000292(n+1).
a(n) = Sum_{k=0..n} (-1)^(n-k)*C(k+4, 4). - Paul Barry, Jul 01 2003
a(n) = (3*(-1)^n + 93 + 168*n + 100*n^2 + 24*n^3 + 2*n^4)/96. - Cecilia Rossiter (cecilia(AT)noticingnumbers.net), Dec 14 2004
From Paul Barry, Apr 16 2005: (Start)
a(n) = Sum_{k=0..floor(n/2)} binomial(n-2k+3, 3).
a(n) = Sum_{k=0..n} binomial(k+3, 3)*(1-(-1)^(n+k-1))/2. (End)
a(n) = A108561(n+5,n) for n > 0. - Reinhard Zumkeller, Jun 10 2005
From Wesley Ivan Hurt, Apr 01 2015: (Start)
a(n) = 4*a(n-1) - 5*a(n-2) + 5*(n-4) - 4*a(n-5) + a(n-6).
a(n) = Sum_{i=0..n+3} (n+3-i) * floor(i^2/2)/2. (End)
Boas-Buck recurrence: a(n) = (1/n)*Sum_{p=0..n-1} (5 + (-1)^(n-p))*a(p), n >= 1, a(0) = 1. See the Boas-Buck comment in A158454 (here for the unsigned column k = 2 with offset 0). - Wolfdieter Lang, Aug 10 2017
Convolution of A000217 and A004526. - R. J. Mathar, Mar 29 2018
E.g.f.: ((48 + 147*x + 93*x^2 + 18*x^3 + x^4)*cosh(x) + (45 + 147*x + 93*x^2 + 18*x^3 + x^4)*sinh(x))/48. - Stefano Spezia, Jan 12 2022

Extensions

Formulae corrected by Bruno Berselli, Sep 13 2012

A305258 List of y-coordinates of a point moving in a smooth counterclockwise spiral rotated by Pi/4.

Original entry on oeis.org

0, 0, 1, 0, -1, -1, 0, 1, 2, 1, 0, -1, -2, -2, -1, 0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -3, -2, -1, 0, 1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -4, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3
Offset: 0

Views

Author

Hugo Pfoertner, May 29 2018

Keywords

Examples

			Sequence gives y-coordinate of the n-th point of the following spiral:
   d:
   4 |                  32  49
     |                 /   \   \
   3 |              33  18  31  48
     |             /   /   \   \   \
   2 |          34  19   8  17  30  47
     |         /   /   /   \   \   \   \
   1 |      35  20   9   2   7  16  29  46
     |     /   /   /   /   \   \   \   \   \
   0 |  36  21  10   3   0---1   6  15  28  45
     |     \   \   \   \       /   /   /   /
  -1 |      37  22  11   4---5  14  27  44
     |         \   \   \      /    /   /
  -2 |          38  23  12--13  26  43
     |             \   \       /   /
  -3 |              39  24--25  42
     |                 \       /
  -4 |                  40--41
       _______________________________________
  x:    -4  -3  -2  -1   0   1   2   3   4   5
		

Crossrefs

A010751 gives sequence of x-coordinates.
Cf. A053616.

Programs

  • PARI
    up=-1;print1(x=0,", ");for(stride=1,12,up=-up;x+=stride;y=x+stride+1;for(k=x,y-1,print1(up*min(k-x,y-k), ", "))) \\ Hugo Pfoertner, Jun 02 2018

Formula

a(n) = A053616(n)*sign(sin(Pi*(1+sqrt(1+8*n))/2)), so that abs(a(n)) = A053616(n).
a(n) = A010751(n-floor((1/2)*(sqrt(2n-1)+1))). - William McCarty, Jul 29 2021

A215468 Sum of the 8 nearest neighbors of n in a rotated-square spiral with positive integers.

Original entry on oeis.org

50, 62, 72, 86, 76, 84, 122, 88, 144, 104, 166, 120, 152, 160, 144, 218, 160, 168, 248, 184, 192, 278, 208, 216, 260, 268, 240, 248, 346, 264, 272, 280, 384, 296, 304, 312, 422, 328, 336, 344, 400, 408, 368, 376, 384, 506, 400, 408, 416, 424, 552, 440, 448, 456, 464, 598
Offset: 1

Views

Author

Alex Ratushnyak, Aug 11 2012

Keywords

Examples

			Spiral begins:
                     85
                     /
                    /
                  84 61-62
                  /  /    \
                 /  /      \
               83 60 41-42 63
               /  /  /    \  \
              /  /  /      \  \
            82 59 40 25-26 43 64
            /  /  /  /    \  \  \
           /  /  /  /      \  \  \
         81 58 39 24 13-14 27 44 65
         /  /  /  /  /    \  \  \  \
        /  /  /  /  /      \  \  \  \
      80 57 38 23 12  5--6 15 28 45 66
      /  /  /  /  /  /    \  \  \  \  \
     /  /  /  /  /  /      \  \  \  \  \
   79 56 37 22 11  4  1--2  7 16 29 46 67
     \  \  \  \  \  \   /  /  /  /  /  /
      \  \  \  \  \  \ /  /  /  /  /  /
      78 55 36 21 10  3  8 17 30 47 68
        \  \  \  \  \   /  /  /  /  /
         \  \  \  \  \ /  /  /  /  /
         77 54 35 20  9 18 31 48 69
           \  \  \  \   /  /  /  /
            \  \  \  \ /  /  /  /
            76 53 34 19 32 49 70
              \  \  \   /  /  /
               \  \  \ /  /  /
               75 52 33 50 71
                 \  \   /  /
                  \  \ /  /
                  74 51 72
                    \   /
                     \ /
                     73
.
The 8 nearest neighbors of 4 are 1,3,5,10,11,12,21,23, their sum is 86, so a(4)=86.
		

Crossrefs

Coordinates (but 0-based): A010751, A305258.

Programs

  • Python
    SIZE=17  # must be odd
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    saveX = [0]* (SIZE*SIZE+1)
    saveY = [0]* (SIZE*SIZE+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]
        i,j = grid[(posY-1)*SIZE+posX-1], grid[(posY-1)*SIZE+posX+1]
        u,v = grid[(posY+1)*SIZE+posX-1], grid[(posY+1)*SIZE+posX+1]
        if i==0 or j==0 or u==0 or v==0:
            break
        k = grid[(posY-1)*SIZE+posX  ] + grid[(posY+1)*SIZE+posX  ]
        k+= grid[ posY   *SIZE+posX-1] + grid[ posY   *SIZE+posX+1]
        print(i+j+u+v+k, end=' ')
    print()
    for y in range(SIZE):
        for x in range(SIZE):
            print('%3d' % grid[y*SIZE+x], end=' ')
        print()
    
  • Python
    def spiral(x, y):
        r = abs(x) + abs(y)
        return 1 + 2*r*r + (y-r if x > 0 else r-y)
    def A215468(n):
        x = A010751(n-1)
        y = A305258(n-1)
        return sum(spiral(x+i, y+j) for i in (-1, 0, 1) for j in (-1, 0, 1)
                   if (i, j) != (0, 0)) # David Radcliffe, Aug 05 2025

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

A329022 Squares visited by a knight moving on a diagonal spiral numbered board and moving to the lowest available unvisited square at each step.

Original entry on oeis.org

1, 14, 7, 3, 6, 4, 8, 5, 10, 2, 9, 17, 28, 43, 13, 15, 26, 24, 11, 20, 32, 48, 29, 44, 63, 25, 12, 21, 34, 18, 30, 45, 27, 16, 31, 19, 35, 22, 39, 57, 36, 23, 37, 54, 75, 51, 71, 95, 68, 91, 65, 46, 69, 49, 33, 53, 74, 50, 70, 47, 66, 89, 116, 42, 40, 58, 80, 55, 38, 56, 77, 102, 131, 52, 72, 96, 124
Offset: 1

Views

Author

Scott R. Shannon, Nov 02 2019

Keywords

Comments

This sequence uses a diagonal spiral of numbers to enumerate the squares on the board. The knight starts on the square with number 1. At each step the knight goes to an unvisited square with the smallest number.
The sequence if finite. After 3722 steps the square with number 3541 is visited, after which all neighboring squares have been visited.

Examples

			The board is numbered in a spiral moving along the diagonals of the square grid:
.
                       19
                     /   \
                   /       \
                 20    9     18
               /     /   \     \
             /     /       \     \
           21    10    3     8     17
         /     /     /   \     \     \
       /     /     /       \     \     \
     22    11    4     1 --- 2     7     16
       \     \     \             /     /     .
         \     \     \         /     /     .
           23    12    5 --- 6     15    28
             \     \             /     /
               \     \         /     /
                 24    13 -- 14    27
                   \             /
                     \         /
                       25 -- 26
.
    +----+----+----+----+----+----+----+
    | 76 | 53 | 34 | 19 | 32 | 49 | 70 |
    +----+----+----+----+----+----+----+
    | 54 | 35 | 20 |  9 | 18 | 31 | 48 |
    +----+----+----+----+----+----+----+
    | 36 | 21 | 10 |  3 |  8 | 17 | 30 |
    +----+----+----+----+----+----+----+
    | 22 | 11 |  4 |  1 |  2 |  7 | 16 |
    +----+----+----+----+----+----+----+
    | 38 | 23 | 12 |  5 |  6 | 15 | 28 |
    +----+----+----+----+----+----+----+
    | 58 | 39 | 24 | 13 | 14 | 27 | 44 |
    +----+----+----+----+----+----+----+
    | 82 | 59 | 40 | 25 | 26 | 43 | 64 |
    +----+----+----+----+----+----+----+
.
		

Crossrefs

Cf. A316667.
Cf. A010751(n), A305258(n) for coordinates of point number n+1.

A337822 Permutation of the natural numbers formed by numbering an infinite square grid by a counterclockwise diamond spiral and visiting them by a counterclockwise stair step spiral.

Original entry on oeis.org

1, 2, 8, 3, 9, 20, 10, 21, 11, 4, 12, 5, 13, 14, 6, 15, 7, 16, 30, 17, 31, 18, 32, 19, 33, 52, 34, 53, 35, 54, 36, 55, 37, 22, 38, 23, 39, 24, 40, 25, 41, 42, 26, 43, 27, 44, 28, 45, 29, 46, 68, 47, 69, 48, 70, 49, 71, 50, 72, 51, 73, 100, 74, 101, 75, 102, 76
Offset: 1

Views

Author

Mohammed Yaseen, Sep 24 2020

Keywords

Examples

			The path begins:
.
               ---33
                   |
              34  19--32
                       |
          35  20---9  18--31  48
               |   |       |
      36  21--10   3---8  17--30  47
           |           |       |
  37  22  11---4   1---2   7--16  29  46
               |           |
      38  23  12---5   6--15  28  45
                   |   |
          39  24  13--14  27  44
.
              40  25  26  43
.
                  41  42
.
		

Crossrefs

Cf. A102083.
Diamond spiral coordinates (but 0-based): A010751, A305258.
Same type of visit on other types of spirals: A334619, A337838.

Formula

a(A102083(n)) = A102083(n) and a(A102083(n)+1) = A102083(n)+1.

A350549 a(n) is the permanent of a square matrix M(n) whose general element M_{i,j} is defined by floor((j - i + 1)/2).

Original entry on oeis.org

1, 0, 0, -1, 2, 20, -120, -4608, 41952, 2325024, -34876800, -3133087200, 66120252480, 8258565859200, -239533775631360, -40631838221721600, 1532513262269767680, 335620705700380262400, -16054693916748370329600, -4428138916386119015424000, 261291002534430572648448000
Offset: 0

Views

Author

Stefano Spezia, Jan 04 2022

Keywords

Comments

The matrix M(n) is the n-th principal submatrix of the array A010751.
In the n X n matrix M(n): the zero element appears 2*n - 1 times; the positive integers k appears iff 0 < k < floor(n/2), 2*n - 1 - A040002(k-1) times; the negative integer k appears iff -k < ceiling(n/2), 2*n - 5 + 4*(k + 1) times.
det(M(n)) = 0, except for n = 3 for which det(M(3)) = -1.
The trace and the subdiagonal sum of the matrix M(n) are zero.
The antitrace of the matrix M(n) is A142150(n+1).
The superdiagonal sum of the matrix M(n) is equal to n - 1.
The sum of the elements of the matrix M(n) is A002620(n).

Examples

			For n = 3 the matrix M(3) is
     0, 1, 1
     0, 0, 1
    -1, 0, 0
with permanent a(3) = -1.
For n = 4 the matrix M(4) is
    0,  1,  1,  2
    0,  0,  1,  1
   -1,  0,  0,  1
   -1, -1,  0,  0
with permanent a(4) = 2.
		

Crossrefs

Programs

  • Maple
    a:= n-> `if`(n=0, 1, LinearAlgebra[Permanent](
             Matrix(n, (i, j)-> floor((j-i+1)/2)))):
    seq(a(n), n=0..20);  # Alois P. Heinz, Jan 19 2022
  • Mathematica
    Join[{1},Table[Permanent[Table[Floor[(j-i+1)/2],{i,n},{j,n}]],{n,20}]]
  • PARI
    a(n) = matpermanent(matrix(n, n, i, j, (j - i + 1)\2)); \\ Michel Marcus, Jan 04 2022
    
  • Python
    from sympy import Matrix
    def A350549(n): return 1 if n == 0 else Matrix(n,n,lambda i,j:(j-i+1)//2).per() # Chai Wah Wu, Jan 12 2022

A305259 x-coordinates of a point moving counterclockwise on concentric squares of grid points rotated by Pi/4 with side length m*sqrt(2), m=1,2,..., with jump to next square on the positive x-axis.

Original entry on oeis.org

1, 0, -1, 0, 2, 1, 0, -1, -2, -1, 0, 1, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 4, 3, 2, 1, 0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
Offset: 1

Views

Author

Hugo Pfoertner, Jun 02 2018

Keywords

Comments

The corresponding y-coordinates of the point are given in A010751.

Examples

			   y ^
     |                       |
   3 |                      16     28
     |                     / | \      \
     |                   /   |   \      \
     |                 /     |     \      \
   2 |               17      7     15     27
     |              /      / | \      \      \
     |            /      /   |   \      \      \
     |          /      /     |     \      \      \
   1 |        18      8      2      6     14     26
     |       /      /      / | \      \      \      \
     |     /      /      /   |   \      \      \      \
     |   /      /      /     |     \      \      \      \
   0 +-19------9------3------+------1------5-----13-----25->
     |   \      \      \     |    --------/      /      /
     |     \      \      \   |   /     ----------      /
     |       \      \      \ | /      /      ----------
  -1 |        20     10      4     12     24
     |          \      \     |     /      /
     |            \      \   |   /      /
     |              \      \ | /      /
  -2 |               21     11     23
     |                 \     |     /
     |                   \   |   /
     |                     \ | /
  -3 |                      22
     |                       |
     +-----------------------+--------------------------->
       -3     -2     -1      0      1      2      3      x
		

Crossrefs

Cf. A001844 (jump to next square), A010751 (y-coordinates), A304587.

Programs

  • PARI
    for(m=1,6,vert=[m,0,-m,0,m];for(k=1,4,v=vert[k];w=vert[k+1];s=sign(w-v);forstep(j=v,w-s,s,print1(j,", ")))) \\ Hugo Pfoertner, Jun 02 2018

A350689 a(n) = n*(1 - (-1)^n - 2*(3 + (-1)^n)*n^2 + 2*n^4)/384.

Original entry on oeis.org

0, 0, 0, 1, 4, 15, 36, 84, 160, 300, 500, 825, 1260, 1911, 2744, 3920, 5376, 7344, 9720, 12825, 16500, 21175, 26620, 33396, 41184, 50700, 61516, 74529, 89180, 106575, 126000, 148800, 174080, 203456, 235824, 273105, 313956, 360639, 411540, 469300, 532000, 602700
Offset: 0

Views

Author

Stefano Spezia, Jan 12 2022

Keywords

Comments

Definitions: (Start)
The k-th exterior power of a vector space V of dimension n is a vector subspace spanned by elements, called k-vectors, that are the exterior product of k vectors v_i in V.
Given a square matrix A that describes the vectors v_i in terms of a basis of V, the k-th exterior power of the matrix A is the matrix that represents the k-vectors in terms of the basis of V. (End)
Conjectures: (Start)
For n > 1, a(n) is the absolute value of the trace of the 3rd exterior power of an n X n square matrix M(n) defined as M[i,j] = floor((j - i + 1)/2). Equivalently, a(n) is the absolute value of the coefficient of the term [x^(n-3)] in the characteristic polynomial of the matrix M(n), or the absolute value of the sum of all principal minors of M(n) of size 3.
For k > 3, the trace of the k-th exterior power of the matrix M(n) is equal to zero. (End)
The matrix M(n) is the n-th principal submatrix of the array A010751.

Crossrefs

Cf. A002620 (elements sum of the matrix M(n)), A010751, A108674, A350549 (permanent of the matrix M(n)).

Programs

  • Mathematica
    Table[n(1 - (-1)^n - 2*(3 + (-1)^n)n^2 + 2n^4)/384,{n,0,41}]

Formula

O.g.f.: x^3*(1 + 2*x + 4*x^2 + 2*x^3 + x^4)/((1 - x)^6*(1 + x)^4).
E.g.f.: x*(x*(x^3 + 10*x^2 + 23*x + 3)*cosh(x) + (x^4 + 10*x^3 + 21*x^2 + 9*x - 3)*sinh(x))/192.
a(n) = 2*a(n-1) + 3*a(n-2) - 8*a(n-3) - 2*a(n-4) + 12*a(n-5) - 2*a(n-6) - 8*a(n-7) + 3*a(n-8) + 2*a(n-9) - a(n-10) for n > 9.
a(2*n+1) = A108674(n-1) for n > 0.
Sum_{n>2} 1/a(n) = 192*log(2) - 6*zeta(3) - 249/2 = 1.371917248551933695710...
Showing 1-10 of 10 results.