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.

A329116 Successively count to (-1)^(n+1)*n (n = 0, 1, 2, ... ).

This page as a plain text file.
%I A329116 #84 Aug 05 2022 07:45:55
%S A329116 0,1,0,-1,-2,-1,0,1,2,3,2,1,0,-1,-2,-3,-4,-3,-2,-1,0,1,2,3,4,5,4,3,2,
%T A329116 1,0,-1,-2,-3,-4,-5,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,6,5,4,3,2,1,0,
%U A329116 -1,-2,-3,-4,-5,-6,-7,-8
%N A329116 Successively count to (-1)^(n+1)*n (n = 0, 1, 2, ... ).
%C A329116 Also x-coordinates of a point moving in counterclockwise triangular spiral (A329972 gives the y-coordinates).
%H A329116 Rémy Sigrist, <a href="/A329116/b329116.txt">Table of n, a(n) for n = 0..10000</a>
%H A329116 <a href="/index/Con#coordinates_2D_curves">Index entries for sequences related to coordinates of 2D curves</a>
%F A329116 a(n) = (-1)^t * (t^2 - t - n) where t=ceiling(sqrt(n)).
%F A329116 a(n) = (-1)^t * floor(t^2 - sqrt(n) - n) where t=ceiling(sqrt(n)).
%F A329116 A053615(n) = abs(a(n)).
%F A329116 abs(A196199(n)) = abs(a(n)).
%F A329116 A255175(n) = a(n+1).
%e A329116    y
%e A329116      |
%e A329116    4 |                         56
%e A329116      |                           \
%e A329116      |                            \
%e A329116      |                             \
%e A329116    3 |                         30  55
%e A329116      |                         / \   \
%e A329116      |                        /   \   \
%e A329116      |                       /     \   \
%e A329116    2 |                     31  12  29  54
%e A329116      |                     /   / \   \   \
%e A329116      |                    /   /   \   \   \
%e A329116      |                   /   /     \   \   \
%e A329116    1 |                 32  13   2  11  28  53
%e A329116      |                 /   /   / \   \   \   \
%e A329116      |                /   /   /   \   \   \   \
%e A329116      |               /   /   /     \   \   \   \
%e A329116    0 |             33  14   3   0---1  10  27  52
%e A329116      |             /   /   /             \   \   \
%e A329116      |            /   /   /               \   \   \
%e A329116      |           /   /   /                 \   \   \
%e A329116   -1 |         34  15   4---5---6---7---8---9  26  51
%e A329116      |         /   /                             \   \
%e A329116      |        /   /                               \   \
%e A329116      |       /   /                                 \   \
%e A329116   -2 |     35  16--17--18--19--20--21--22--23--24--25  50
%e A329116      |     /                                             \
%e A329116      |    /                                               \
%e A329116      |   /                                                 \
%e A329116   -3 | 36--37--38--39--40--41--42--43--44--45--46--47--48--49
%e A329116      |
%e A329116      +--------------------------------------------------------
%e A329116    x:  -6  -5  -4  -3  -2  -1   0   1   2   3   4   5   6   7
%e A329116 We count as follows. Start at n=0 with 0.
%e A329116 Next step is to count to 1: so we have 0, 1.
%e A329116 Next step is to count to -2, so we have 0, 1, 0, -1, -2.
%e A329116 Next we have to go to +3, so we have 0, 1, 0, -1, -2, -1, 0, 1, 2, 3.
%e A329116 And so on.
%t A329116 a[n_] := Table[(-1)^(# + 1)*(-#^2 + # + k) &[Ceiling@ Sqrt@ k], {k, 0, n}]; a[64]
%o A329116 (Python)
%o A329116 from math import isqrt
%o A329116 def A329116(n): return ((t:=1+isqrt(n-1))*(t-1)-n)*(-1 if t&1 else 1) if n else 0 # _Chai Wah Wu_, Aug 04 2022
%Y A329116 Cf. A053615, A196199, A339265 (first differences). Essentially the same as A255175.
%K A329116 sign,easy,look
%O A329116 0,5
%A A329116 _Mikk Heidemaa_, Nov 13 2019