login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A329116 Successively count to (-1)^(n+1)*n (n = 0, 1, 2, ... ). 7
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, 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, -1, -2, -3, -4, -5, -6, -7, -8 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,5
COMMENTS
Also x-coordinates of a point moving in counterclockwise triangular spiral (A329972 gives the y-coordinates).
LINKS
FORMULA
a(n) = (-1)^t * (t^2 - t - n) where t=ceiling(sqrt(n)).
a(n) = (-1)^t * floor(t^2 - sqrt(n) - n) where t=ceiling(sqrt(n)).
A053615(n) = abs(a(n)).
abs(A196199(n)) = abs(a(n)).
A255175(n) = a(n+1).
EXAMPLE
y
|
4 | 56
| \
| \
| \
3 | 30 55
| / \ \
| / \ \
| / \ \
2 | 31 12 29 54
| / / \ \ \
| / / \ \ \
| / / \ \ \
1 | 32 13 2 11 28 53
| / / / \ \ \ \
| / / / \ \ \ \
| / / / \ \ \ \
0 | 33 14 3 0---1 10 27 52
| / / / \ \ \
| / / / \ \ \
| / / / \ \ \
-1 | 34 15 4---5---6---7---8---9 26 51
| / / \ \
| / / \ \
| / / \ \
-2 | 35 16--17--18--19--20--21--22--23--24--25 50
| / \
| / \
| / \
-3 | 36--37--38--39--40--41--42--43--44--45--46--47--48--49
|
+--------------------------------------------------------
x: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
We count as follows. Start at n=0 with 0.
Next step is to count to 1: so we have 0, 1.
Next step is to count to -2, so we have 0, 1, 0, -1, -2.
Next we have to go to +3, so we have 0, 1, 0, -1, -2, -1, 0, 1, 2, 3.
And so on.
MATHEMATICA
a[n_] := Table[(-1)^(# + 1)*(-#^2 + # + k) &[Ceiling@ Sqrt@ k], {k, 0, n}]; a[64]
PROG
(Python)
from math import isqrt
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
CROSSREFS
Cf. A053615, A196199, A339265 (first differences). Essentially the same as A255175.
Sequence in context: A106509 A324692 A228110 * A255175 A196199 A053615
KEYWORD
sign,easy,look
AUTHOR
Mikk Heidemaa, Nov 13 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 07:07 EDT 2024. Contains 371964 sequences. (Running on oeis4.)