Displaying 11-20 of 81 results found.
0, 2, 12, 30, 56, 90, 132, 182, 240, 306, 380, 462, 552, 650, 756, 870, 992, 1122, 1260, 1406, 1560, 1722, 1892, 2070, 2256, 2450, 2652, 2862, 3080, 3306, 3540, 3782, 4032, 4290, 4556, 4830, 5112, 5402, 5700, 6006, 6320, 6642, 6972, 7310, 7656, 8010, 8372
COMMENTS
Write 0,1,2,... in a spiral; sequence gives numbers on one of 4 diagonals (see Example section).
For n>2, the terms represent the sums of those primitive Pythagorean triples with hypotenuse (H) one unit longer than the longest side (L), or H = L + 1. - Richard R. Forberg, Jun 09 2015
For n>1, a(n) is the perimeter of a Pythagorean triangle with an odd leg 2*n-1. - Agola Kisira Odero, Apr 26 2016
A338109(n)/a(n+1) is the Kirchhoff index of the join of the disjoint union of two complete graphs on n vertices with the empty graph on n+1 vertices.
Equivalently, the graph can be described as the graph on 3*n + 1 vertices with labels 0..3*n and with i and j adjacent iff iff i+j> 0 mod 3.
A338588(n)/a(n+1) is the Kirchhoff index of the disjoint union of two complete graphs each on n and n+1 vertices with the empty graph on n+1 vertices.
Equivalently, the graph can be described as the graph on 3*n + 2 vertices with labels 0..3*n+1 and with i and j adjacent iff i+j> 0 mod 3.
These graphs are cographs. (End)
a(n), n>=1, is the number of paths of minimum length (length=2) from the origin to the cross polytope of size 2 in Z^n (column 2 in A371064). - Shel Kaphan, Mar 09 2024
REFERENCES
R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 2nd ed., 1994, p. 99.
FORMULA
Sum_{n >= 1} 1/a(n) = log(2) (cf. Tijdeman).
Log(2) = Sum_{n >= 1} ((1 - 1/2) + (1/3 - 1/4) + (1/5 - 1/6) + (1/7 - 1/8) + ...) = Sum_{n >= 0} (-1)^n/(n+1). Log(2) = Integral_{x=0..1} 1/(1+x) dx. - Gary W. Adamson, Jun 22 2003
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3).
G.f.: 2*x*(1+3*x)/(1-x)^3. (End)
0 = 12 + a(n)*(-8 + a(n) - 2*a(n+1)) + a(n+1)*(-8 + a(n+1)) for all n in Z. - Michael Somos, Jan 28 2017
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 - log(2)/2. - Amiram Eldar, Jul 31 2020
EXAMPLE
G.f. = 2*x + 12*x^2 + 30*x^3 + 56*x^4 + 90*x^5 + 132*x^6 + 182*x^7 + 240*x^8 + ...
On a square lattice, place the nonnegative integers at lattice points forming a spiral as follows: place "0" at the origin; then move one step in any of the four cardinal directions and place "1" at the lattice point reached; then turn 90 degrees in either direction and place a "2" at the next lattice point; then make another 90-degree turn in the same direction and place a "3" at the lattice point; etc. The terms of the sequence will lie along one of the diagonals, as seen in the example below:
.
99 64--65--66--67--68--69--70--71--72
| | |
98 63 36--37--38--39--40--41--42 73
| | | | |
97 62 35 16--17--18--19--20 43 74
| | | | | | |
96 61 34 15 4---5---6 21 44 75
| | | | | | | | |
95 60 33 14 3 *0* 7 22 45 76
| | | | | | | | | |
94 59 32 13 *2*--1 8 23 46 77
| | | | | | | |
93 58 31 *12*-11--10---9 24 47 78
| | | | | |
92 57 *30*-29--28--27--26--25 48 79
| | | |
91 *56*-55--54--53--52--51--50--49 80
| |
*90*-89--88--87--86--85--84--83--82--81
.
PROG
(Haskell)
a002939 n = (* 2) . a000384
a002939_list = scanl1 (+) a017089_list
CROSSREFS
Cf. numbers of the form n*(n*k-k+4)/2 listed in A226488 (this sequence is the case k=8). - Bruno Berselli, Jun 10 2013
List of x-coordinates of point moving in clockwise square spiral.
+10
77
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
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
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.
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
EXAMPLE
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
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;
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 *)
PROG
(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(n<m, -k, n-3*k)); \\ Kevin 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
(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
CROSSREFS
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
AUTHOR
Nikolas Garofil (nikolas(AT)garofil.be), Mar 16 2010
0, 6, 20, 42, 72, 110, 156, 210, 272, 342, 420, 506, 600, 702, 812, 930, 1056, 1190, 1332, 1482, 1640, 1806, 1980, 2162, 2352, 2550, 2756, 2970, 3192, 3422, 3660, 3906, 4160, 4422, 4692, 4970, 5256, 5550, 5852, 6162, 6480, 6806, 7140, 7482, 7832, 8190, 8556, 8930
COMMENTS
a(n) is the number of edges in (n+1) X (n+1) square grid with all horizontal, vertical and diagonal segments filled in. - Asher Auel, Jan 12 2000
In other words, the edge count of the (n+1) X (n+1) king graph. - Eric W. Weisstein, Jun 20 2017
Write 0,1,2,... in clockwise spiral; sequence gives numbers on one of 4 diagonals. (See Example section.)
The identity (4*n+1)^2 - (4*n^2+2*n)*(2)^2 = 1 can be written as A016813(n)^2 - a(n)*2^2 = 1. - Vincenzo Librandi, Jul 20 2010 - Nov 25 2012
Starting with "6" = binomial transform of [6, 14, 8, 0, 0, 0, ...]. - Gary W. Adamson, Aug 27 2010
The hyper-Wiener index of the crown graph G(n) (n>=3). The crown graph G(n) is the graph with vertex set {x(1), x(2), ..., x(n), y(1), y(2), ..., y(n)} and edge set {(x(i), y(j)): 1 <= i,j <= n, i != j} (= the complete bipartite graph K(n,n) with horizontal edges removed). The Hosoya-Wiener polynomial of G(n) is n(n-1)(t+t^2)+nt^3. - Emeric Deutsch, Aug 29 2013
REFERENCES
R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 2nd ed., 1994, p. 99.
LINKS
Eric Weisstein's World of Mathematics, Edge Count.
Eric Weisstein's World of Mathematics, King Graph.
FORMULA
a(n) = 4*n^2 + 2*n.
Sum_{n>=1} 1/a(n) = 1 - log(2).
Sum_{n>=1} 1/a(n)^2 = 2*log(2) + Pi^2/6 - 3. (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 + log(2)/2 - 1. - Amiram Eldar, Feb 22 2022
EXAMPLE
64--65--66--67--68--69--70--71--72
|
63 36--37--38--39--40--41--42
| | |
62 35 16--17--18--19--20 43
| | | | |
61 34 15 4---5---6 21 44
| | | | | | |
60 33 14 3 0 7 22 45
| | | | | | | |
59 32 13 2---1 8 23 46
| | | | | |
58 31 12--11--10---9 24 47
| | | |
57 30--29--28--27--26--25 48
| |
56--55--54--53--52--51--50--49
MATHEMATICA
LinearRecurrence[{3, -3, 1}, {0, 6, 20}, 40] (* Harvey P. Dale, Aug 11 2011 *)
CROSSREFS
Cf. A001477, A007395, A007494, A007742, A014105, A016813, A033954, A045896, A046092, A054000, A118729, A173511.
Sequences from spirals: A001107, A002939, A007742, A033951, A033952, A033953, A033954, A033989, A033990, A033991, this sequence, A033996, A033988.
Expansion of g.f. x/((1 - x)^2*(1 - x^3)).
(Formerly M0638 N0233)
+10
71
0, 1, 2, 3, 5, 7, 9, 12, 15, 18, 22, 26, 30, 35, 40, 45, 51, 57, 63, 70, 77, 84, 92, 100, 108, 117, 126, 135, 145, 155, 165, 176, 187, 198, 210, 222, 234, 247, 260, 273, 287, 301, 315, 330, 345, 360, 376, 392, 408, 425, 442, 459, 477, 495, 513, 532, 551, 570, 590
COMMENTS
a(n-3) is the number of aperiodic necklaces (Lyndon words) with 3 black beads and n-3 white beads.
Number of triangular partitions (see Almkvist).
Consists of arithmetic progression quadruples of common difference n+1 starting at A045943(n). Refers to the least number of coins needed to be rearranged in order to invert the pattern of a (n+1)-rowed triangular array. For instance, a 5-rowed triangular array requires a minimum of a(4)=5 rearrangements (shown bracketed here) for it to be turned upside down.
.....{*}..................{*}*.*{*}{*}
.....*.*....................*.*.*.{*}
....*.*.*....---------\......*.*.*
..{*}*.*.*...---------/.......*.*
{*}{*}*.*{*}..................{*}
Partial sums of 1,1,1,2,2,2,3,3,3,4,4,4,... - Jon Perry, Mar 01 2004
Sum of three successive terms is a triangular number in natural order starting with 3: a(n)+a(n+1)+a(n+2) = T(n+2) = (n+2)*(n+3)/2. - Amarnath Murthy, Apr 25 2004
Apply Riordan array (1/(1-x^3),x) to n. - Paul Barry, Apr 16 2005
In the Moree definition, (-1)^n*a(n) is the 3rd Witt transform of A033999 and (-1)^n* A004524(n) with 2 leading zeros dropped is the 2nd Witt transform of A033999. - R. J. Mathar, Nov 08 2008
Column sums of:
1 2 3 4 5 6 7 8 9.....
1 2 3 4 5 6.....
1 2 3.....
........................
----------------------
1 2 3 5 7 9 12 15 18 - Jon Perry, Nov 16 2010
a(n) is the sum of the positive integers <= n that have the same residue modulo 3 as n. They are the additive counterpart of the triple factorial numbers. - Peter Luschny, Jul 06 2011
a(n+1) is the number of 3-tuples (w,x,y) with all terms in {0,...,n} and w=3*x+y. - Clark Kimberling, Jun 04 2012
a(n+1) is the number of pairs (x,y) with x and y in {0,...,n}, x-y = (1 mod 3), and x+y < n. - Clark Kimberling, Jul 02 2012
a(n+1) is the number of partitions of n into two sorts of part(s) 1 and one sort of (part) 3. - Joerg Arndt, Jun 10 2013
Arrange A004523 in rows successively shifted to the right two spaces and sum the columns:
1 2 2 3 4 4 5 6 6...
1 2 2 3 4 4 5...
1 2 2 3 4...
1 2 2...
1...
------------------------------
Also the number of triples of positive integers summing to n + 4, the first less than each of the other two. Also the number of triples of positive integers summing to n + 2, the first less than or equal to each of the other two. - Gus Wiseman, Oct 11 2020
REFERENCES
Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 73, problem 25.
Ulrich Faigle, Review of Gerhard Post and G.J. Woeginger, Sports tournaments, home-away assignments and the break minimization problem, MR2224983(2007b:90134), 2007.
Hansraj Gupta, Partitions of j-partite numbers into twelve or a smaller number of parts. Collection of articles dedicated to Professor P. L. Bhatnagar on his sixtieth birthday. Math. Student 40 (1972), 401-441 (1974).
Richard K. Guy, A problem of Zarankiewicz, in P. Erdős and G. Katona, editors, Theory of Graphs (Proceedings of the Colloquium, Tihany, Hungary), Academic Press, NY, 1968, pp. 119-150, (p. 126, divided by 2).
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Richard K. Guy, A problem of Zarankiewicz, Research Paper No. 12, Dept. of Math., Univ. Calgary, Jan. 1967. [Annotated and scanned copy, with permission]
FORMULA
Euler transform of length 3 sequence [2, 0, 1].
a(3*k-1) = k*(3*k + 1)/2;
a(3*k) = 3*k*(k + 1)/2;
a(3*k+1) = (k + 1)*(3*k + 2)/2.
a(n) = floor( (n+1)*(n+2)/6 ) = floor( A000217(n+1)/3 ).
G.f.: x / ((1-x)^2 * (1-x^3)).
a(n) = 1 + a(n-1) + a(n-3) - a(n-4).
a(-3-n) = a(n). (End)
a(n) = a(n-3) + n for n > 2; a(0)=0, a(1)=1, a(2)=2. - Paul Barry, Jul 14 2004
a(n) = binomial(n+3, 3)/(n+3) + cos(2*Pi*(n-1)/3)/9 + sqrt(3)sin(2*Pi*(n-1)/3)/9 - 1/9. - Paul Barry, Jan 01 2005
a(n) = Sum_{k=0..n} k*(cos(2*Pi*(n-k)/3 + Pi/3)/3 + sqrt(3)*sin(2*Pi*(n-k)/3 + Pi/3)/3 + 1/3).
a(n) = Sum_{k=0..floor(n/3)} n-3*k. (End)
For n > 1, a(n) = A000217(n) - a(n-1) - a(n-2); a(0)=0, a(1)=1.
G.f.: x/(1 + x + x^2)/(1 - x)^3. - Maksym Voznyy (voznyy(AT)mail.ru), Jul 27 2009
a(n) = (4 + 3*n^2 + 9*n)/18 + ((n mod 3) - ((n-1) mod 3))/9. - Klaus Brockhaus, Oct 01 2009
a(n) = 2*a(n-1) - a(n-2) + a(n-3) - 2*a(n-4) + a(n-5), with n>4, a(0)=0, a(1)=1, a(2)=2, a(3)=3, a(4)=5. - Harvey P. Dale, Jul 25 2011
G.f.: x*G(0), where G(k) = 1 + x*(3*k+4)/(3*k + 2 - 3*x*(k+2)*(3*k+2)/(3*(1+x)*k + 6*x + 4 - x*(3*k+4)*(3*k+5)/(x*(3*k+5) + 3*(k+1)/G(k+1)))); (continued fraction). - Sergei N. Gladkovskii, Jun 10 2013
0 = a(n)*(a(n+2) + a(n+3)) + a(n+1)*(-2*a(n+2) - a(n+3) + a(n+4)) + a(n+2)*(a(n+2) - 2*a(n+3) + a(n+4)) for all n in Z. - Michael Somos, Jan 22 2014
Sum_{n>=1} 1/a(n) = 20/3 - 2*Pi/sqrt(3). - Amiram Eldar, Sep 27 2022
E.g.f.: (exp(x)*(4 + 12*x + 3*x^2) - 4*exp(-x/2)*cos(sqrt(3)*x/2))/18. - Stefano Spezia, Apr 05 2023
EXAMPLE
G.f. = x + 2*x^2 + 3*x^3 + 5*x^4 + 7*x^5 + 9*x^6 + 12*x^7 + 15*x^8 + 18*x^9 + ...
1+2+3=6=t(3), 2+3+5=t(4), 5+7+9=t(5).
[n] a(n)
--------
[1] 1
[2] 2
[3] 3
[4] 1 + 4
[5] 2 + 5
[6] 3 + 6
[7] 1 + 4 + 7
[8] 2 + 5 + 8
[9] 3 + 6 + 9
a(7) = floor(2/3) +floor(3/3) +floor(4/3) +floor(5/3) +floor(6/3) +floor(7/3) +floor(8/3) +floor(9/3) = 12. - Bruno Berselli, Aug 29 2013
MAPLE
A001840 := n->floor((n+1)*(n+2)/6);
A001840:=-1/((z**2+z+1)*(z-1)**3); # conjectured (correctly) by Simon Plouffe in his 1992 dissertation
MATHEMATICA
a[0]=0; a[1]=1; a[n_]:= a[n]= n(n+1)/2 -a[n-1] -a[n-2]; Table[a[n], {n, 0, 100}]
f[n_] := Floor[(n + 1)(n + 2)/6]; Array[f, 59, 0] (* Or *)
CoefficientList[ Series[ x/((1 + x + x^2)*(1 - x)^3), {x, 0, 58}], x] (* Robert G. Wilson v *)
a[ n_] := With[{m = If[ n < 0, -3 - n, n]}, SeriesCoefficient[ x /((1 - x^3) (1 - x)^2), {x, 0, m}]]; (* Michael Somos, Jul 11 2011 *)
LinearRecurrence[{2, -1, 1, -2, 1}, {0, 1, 2, 3, 5}, 60] (* Harvey P. Dale, Jul 25 2011 *)
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n+4, {3}], #[[1]]<#[[2]]&&#[[1]]<#[[3]]&]], {n, 0, 15}] (* Gus Wiseman, Oct 05 2020 *)
PROG
(PARI) {a(n) = (n+1) * (n+2) \ 6}; /* Michael Somos, Feb 11 2004 */
(Magma) [ n le 2 select n else n*(n+1)/2-Self(n-1)-Self(n-2): n in [1..58] ]; // Klaus Brockhaus, Oct 01 2009
(Sage) [binomial(n, 2) // 3 for n in range(2, 61)] # Zerinvary Lajos, Dec 01 2009
(Haskell)
a001840 n = a001840_list !! n
a001840_list = scanl (+) 0 a008620_list
CROSSREFS
Ordered union of triangular matchstick numbers A045943 and generalized pentagonal numbers A001318.
A337483 counts either weakly increasing or weakly decreasing triples.
A337484 counts neither strictly increasing nor strictly decreasing triples.
0, 5, 18, 39, 68, 105, 150, 203, 264, 333, 410, 495, 588, 689, 798, 915, 1040, 1173, 1314, 1463, 1620, 1785, 1958, 2139, 2328, 2525, 2730, 2943, 3164, 3393, 3630, 3875, 4128, 4389, 4658, 4935, 5220, 5513, 5814, 6123, 6440, 6765, 7098, 7439, 7788, 8145
COMMENTS
Write 0,1,2,... in a clockwise spiral; sequence gives the numbers that fall on the positive y-axis. (See Example section.)
a(n)*Pi is the total length of 4 points circle center spiral after n rotations. The spiral length at each rotation (L(n)) is A004770. The spiral length ratio rounded down [floor(L(n)/L(1))] is A047497. See illustration in links. - Kival Ngaokrajang, Dec 27 2013
For n >= 1, the continued fraction expansion of sqrt(a(n)) is [2n; {4, 4n}]. For n=1, this collapses to [2, {4}]. - Magus K. Chu, Sep 15 2022
REFERENCES
S. M. Ellerstein, The square spiral, J. Recreational Mathematics 29 (#3, 1998) 188; 30 (#4, 1999-2000), 246-250.
R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 2nd ed., 1994, p. 99.
FORMULA
Sum_{n>=1} 1/a(n) = Sum_{k>=0} (-1)^k*zeta(2+k)/4^(k+1) = 0.349762131... . - R. J. Mathar, Jul 10 2012
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n>2, a(0)=0, a(1)=5, a(2)=18. - Philippe Deléham, Mar 26 2013
Sum_{n>=1} 1/a(n) = 4 - Pi/2 - 3*log(2).
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/sqrt(2) + log(2) + sqrt(2)*log(1 + sqrt(2)) - 4. (End)
EXAMPLE
Part of the spiral:
.
64--65--66--67--68
|
63 36--37--38--39--40--41--42
| | |
62 35 16--17--18--19--20 43
| | | | |
61 34 15 4---5---6 21 44
| | | | | | |
60 33 14 3 0 7 22 45
| | | | | | | |
59 32 13 2---1 8 23 46
| | | | | |
58 31 12--11--10---9 24 47
| | | |
57 30--29--28--27--26--25 48
| |
56--55--54--53--52--51--50--49
PROG
(PARI) a(n)=4*n^2+n
(Magma) I:=[0, 5, 18]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+1*Self(n-3): n in [1..50]]; // Vincenzo Librandi, Jan 29 2012
CROSSREFS
Sequences from spirals: A001107, A002939, A007742, A033951, A033952, A033953, A033954, A033989, A033990, A033991, A002943, A033996, A033988.
Cf. index to sequences with numbers of the form n*(d*n+10-d)/2 in A140090.
0, 3, 14, 33, 60, 95, 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
COMMENTS
Write 0,1,2,... in a clockwise spiral; sequence gives numbers on negative x axis. (See illustration in Example.)
This sequence is the number of expressions x generated for a given modulus n in finite arithmetic. For example, n=1 (modulus 1) generates 3 expressions: 0+0=0(mod 1), 0-0=0(mod 1), 0*0=0(mod 1). By subtracting n from 4n^2, we eliminate the counting of those expressions that would include division by zero, which would be, of course, undefined. - David Quentin Dauthier, Nov 04 2007
a(n) is also the Wiener index of the windmill graph D(3,n).
The windmill graph D(m,n) is the graph obtained by taking n copies of the complete graph K_m with a vertex in common (i.e., a bouquet of n pieces of K_m graphs). The Wiener index of a connected graph is the sum of the distances between all unordered pairs of vertices in the graph.
Example: a(2)=14; indeed if the triangles are OAB and OCD, then, denoting distance by d, we have d(O,A)=d(O,B)=d(A,B)=d(O,C)=d(O,D)=d(C,D)=1 and d(A,C)=d(A,D)=d(B,C)=d(B,D)=2. The Wiener index of D(m,n) is (1/2)n(m-1)[(m-1)(2n-1)+1]. For the Wiener indices of D(4,n), D(5,n), and D(6,n) see A152743, A028994, and A180577, respectively. (End)
Even hexagonal numbers divided by 2. - Omar E. Pol, Aug 18 2011
For n > 0, a(n) equals the number of length 3*n binary words having exactly two 0's with the n first bits having at most one 0. For example a(2) = 14. Words are 010111, 011011, 011101, 011110, 100111, 101011, 101101, 101110, 110011, 110101, 110110, 111001, 111010, 111100. - Franck Maminirina Ramaharo, Mar 09 2018
For n >= 1, the continued fraction expansion of sqrt(a(n)) is [2n-1; {1, 2, 1, 4n-2}]. For n=1, this collapses to [1; {1, 2}]. - Magus K. Chu, Sep 06 2022
REFERENCES
S. M. Ellerstein, The square spiral, J. Recreational Mathematics 29 (#3, 1998) 188; 30 (#4, 1999-2000), 246-250.
R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 2nd ed., 1994, p. 99.
FORMULA
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 2. - Harvey P. Dale, Oct 10 2011
E.g.f.: x*(3 + 4*x)*exp(x).
Sum_{n>=1} 1/a(n) = 3*log(2) - Pi/2 = 0.50864521488... (End)
a(n) = binomial(2*n, 2) + 2*n^2.
Sum_{n>=1} (-1)^(n+1)/a(n) = (Pi + log(3-2*sqrt(2)))/sqrt(2) - log(2). - Amiram Eldar, Mar 20 2022
EXAMPLE
Clockwise spiral (with sequence terms parenthesized) begins
16--17--18--19
|
15 4---5---6
| | |
(14) (3) (0) 7
| | | |
13 2---1 8
| |
12--11--10---9
MATHEMATICA
LinearRecurrence[{3, -3, 1}, {0, 3, 14}, 50] (* Harvey P. Dale, Oct 10 2011 *)
CROSSREFS
Cf. A074378, A014848, A152743, A028994, A000326, A001105, A005476, A014635, A016742, A049452, A118729.
1, 5, 17, 37, 65, 101, 145, 197, 257, 325, 401, 485, 577, 677, 785, 901, 1025, 1157, 1297, 1445, 1601, 1765, 1937, 2117, 2305, 2501, 2705, 2917, 3137, 3365, 3601, 3845, 4097, 4357, 4625, 4901, 5185, 5477, 5777, 6085, 6401, 6725, 7057
COMMENTS
Subsequence of A004613: all numbers in this sequence have all prime factors of the form 4k+1. E.g., 40001 = 13*17*181, 13 = 4*3 + 1, 17 = 4*4 + 1, 181 = 4*45 + 1. - Cino Hilliard, Aug 26 2006, corrected by Franklin T. Adams-Watters, Mar 22 2011
Solutions x of the Mordell equation y^2 = x^3 - 3a^2 - 1 for a = 0, 1, 2, ... - Michel Lagneau, Feb 12 2010
For n >= 1, a(n) is numerator of radius r(n) of circle with sagitta = n and cord length = 1. The denominator is A008590(n). - Kival Ngaokrajang, Jun 13 2014
a(n)+6 is prime for n = 0..6 and for n = 15..20. - Altug Alkan, Sep 28 2015
REFERENCES
Donald E. Knuth, The Art of Computer Programming, Addison-Wesley, Reading, MA, 1997, Vol. 1, exercise 1.2.1 Nr. 11, p. 19.
FORMULA
O.g.f.: (1 + 2*x + 5*x^2)/(1-x)^3.
a(n) = 3a(n-1) - 3a(n-2) + a(n-3). (End)
Equals binomial transform of [1, 4, 8, 0, 0, 0, ...]. - Gary W. Adamson, Apr 30 2008
a(n+1) = denominator of Sum_{k=0..n} (-1)^n*(2*n + 1)^3/((2*n + 1)^4 + 4), see Knuth reference. - Reinhard Zumkeller, Apr 11 2010
a(n) = ((2*n - 1)^2 + (2*n + 1)^2)/2. - J. M. Bergot, May 31 2012
Sum_{n>=0} 1/a(n) = (1 + (Pi/2)*coth(Pi/2))/2.
Sum_{n>=0} (-1)^n/a(n) = (1 + (Pi/2)*csch(Pi/2))/2. (End)
Product_{n>=0} (1 + 1/a(n)) = sqrt(2)*csch(Pi/2)*sinh(Pi/sqrt(2)).
Product_{n>=1} (1 - 1/a(n)) = (Pi/2)*csch(Pi/2). (End)
MAPLE
with (combinat):seq(fibonacci(3, 2*n), n=0..42); # Zerinvary Lajos, Apr 21 2008
MATHEMATICA
CoefficientList[Series[(1 + 2 x + 5 x^2) / (1 - x)^3, {x, 0, 50}], x] (* Vincenzo Librandi, Jun 26 2013 *)
LinearRecurrence[{3, -3, 1}, {1, 5, 17}, 50] (* Harvey P. Dale, Dec 28 2021 *)
PROG
(PARI) for(x=0, 100, print1(4*x^2+1", ")) \\ Cino Hilliard, Aug 26 2006
(Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!((1+2*x+5*x^2)/((1-x)^3))); /* or */ I:=[1, 5]; [n le 2 select I[n] else 2*Self(n-1)-Self(n-2)+8: n in [1..50]]; // Vincenzo Librandi, Jun 26 2013
(Haskell)
(Python) for n in range(0, 50): print(4*n**2+1, end=', ') # Stefano Spezia, Nov 01 2018
AUTHOR
Stuart M. Ellerstein (ellerstein(AT)aol.com), Apr 06 2000
EXTENSIONS
Equation corrected, and examples that were based on a different offset removed, by R. J. Mathar, Mar 18 2010
List of y-coordinates of point moving in counterclockwise square spiral.
+10
66
0, 0, 1, 1, 1, 0, -1, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, -1, -2, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -2, -1, 0
COMMENTS
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 a(n) is their -x(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 17 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.
MAPLE
fy:=proc(n) option remember; local k; if n=1 then 0 else
k:=floor(sqrt(4*(n-2)+1)) mod 4;
fy(n-1) - cos(k*Pi/2); fi; end;
MATHEMATICA
a[n_] := a[n] = If[n == 0, 0, a[n-1] - Cos[Mod[Floor[Sqrt[4*(n-1)+1]], 4]* Pi/2]];
PROG
(PARI) L=1; 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, 3*k+n, k), if(n<m, k-n, -k)); \\ Kevin Ryde, Sep 17 2019
(PARI) apply( A274923(n)={my(m=sqrtint(n-=1), k=m\/2); if(m <= n -= 4*k^2, -k, n >= 0, k-n, n >= -m, k, 3*k+n)}, [1..99]) \\ M. F. Hasler, Oct 20 2019
CROSSREFS
The diagonal rays of the square spiral (coordinates (+-n,+-n)) are: A002939 (2n(2n-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
Write 1,2,... in a clockwise spiral; sequence gives numbers on positive x axis.
+10
57
1, 8, 23, 46, 77, 116, 163, 218, 281, 352, 431, 518, 613, 716, 827, 946, 1073, 1208, 1351, 1502, 1661, 1828, 2003, 2186, 2377, 2576, 2783, 2998, 3221, 3452, 3691, 3938, 4193, 4456, 4727, 5006, 5293, 5588, 5891, 6202, 6521, 6848, 7183, 7526, 7877, 8236, 8603, 8978
COMMENTS
a(n) is the first term in a sum of 2*n + 1 consecutive integers that equals (2*n + 1)^3. - Patrick J. McNab, Dec 24 2016
FORMULA
a(n) = 4*n^2 + 3*n + 1.
G.f.: (1 + 5*x + 2*x^2)/(1-x)^3.
Equals A132774 * [1, 2, 3, ...]; = binomial transform of [1, 7, 8, 0, 0, 0, ...]. - Gary W. Adamson, Aug 28 2007
a(0)=1, a(1)=8, a(2)=23, a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3). - Harvey P. Dale, Feb 07 2015
EXAMPLE
Spiral begins:
.
65--66--67--68--69--70--71--72--73
| |
64 37--38--39--40--41--42--43 74
| | | |
63 36 17--18--19--20--21 44 75
| | | | | |
62 35 16 5---6---7 22 45 76
| | | | | | | |
61 34 15 4 1 8 23 46 77
| | | | | | | |
60 33 14 3---2 9 24 47
| | | | | |
59 32 13--12--11--10 25 48
| | | |
58 31--30--29--28--27--26 49
| |
57--56--55--54--53--52--51--50
MATHEMATICA
LinearRecurrence[{3, -3, 1}, {1, 8, 23}, 60] (* Harvey P. Dale, Feb 07 2015 *)
CoefficientList[Series[(1 + 5 x + 2 x^2)/(1 - x)^3, {x, 0, 45}], x] (* Michael De Vlieger, Feb 12 2017 *)
PROG
(PARI) a(n)=4*n^2+3*n+1
(Python)
CROSSREFS
Sequences from spirals: A001107, A002939, A007742, A033951, A033952, A033953, A033954, A033989, A033990, A033991, A002943, A033996, A033988.
AUTHOR
Olivier Gorin (gorin(AT)roazhon.inra.fr)
1, 2, 11, 28, 53, 86, 127, 176, 233, 298, 371, 452, 541, 638, 743, 856, 977, 1106, 1243, 1388, 1541, 1702, 1871, 2048, 2233, 2426, 2627, 2836, 3053, 3278, 3511, 3752, 4001, 4258, 4523, 4796, 5077, 5366, 5663, 5968, 6281, 6602, 6931, 7268, 7613, 7966, 8327
COMMENTS
Also indices in any square spiral organized like A054551.
Equals binomial transform of [1, 1, 8, 0, 0, 0, ...]. - Gary W. Adamson, May 11 2008
FORMULA
G.f.: (1 - x + 8*x^2)/(1-x)^3.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3); a(0)=1, a(1)=2, a(2)=11. - Harvey P. Dale, Oct 10 2011
EXAMPLE
The spiral begins:
.
197-196-195-194-193-192-191-190-189-188-187-186-185-184-183
| |
198 145-144-143-142-141-140-139-138-137-136-135-134-133 182
| | | |
199 146 101-100--99--98--97--96--95--94--93--92--91 132 181
| | | | | |
200 147 102 65--64--63--62--61--60--59--58--57 90 131 180
| | | | | | | |
201 148 103 66 37--36--35--34--33--32--31 56 89 130 179
| | | | | | | | | |
202 149 104 67 38 17--16--15--14--13 30 55 88 129 178
| | | | | | | | | | | |
203 150 105 68 39 18 5---4---3 12 29 54 87 128 177
| | | | | | | | | | | | | |
204 151 106 69 40 19 6 1---2 11 28 53 86 127 176
| | | | | | | | | | | | |
205 152 107 70 41 20 7---8---9--10 27 52 85 126 175
| | | | | | | | | | |
206 153 108 71 42 21--22--23--24--25--26 51 84 125 174
| | | | | | | | |
207 154 109 72 43--44--45--46--47--48--49--50 83 124 173
| | | | | | |
208 155 110 73--74--75--76--77--78--79--80--81--82 123 172
| | | | |
209 156 111-112-113-114-115-116-117-118-119-120-121-122 171
| | |
210 157-158-159-160-161-162-163-164-165-166-167-168-169-170
|
211-212-213-214-215-216-217-218-219-220-221-222-223-224-225
.
MATHEMATICA
LinearRecurrence[{3, -3, 1}, {1, 2, 11}, 50] (* Harvey P. Dale, Jun 01 2024 *)
Search completed in 0.105 seconds
|