OFFSET
0,4
COMMENTS
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..10000
FORMULA
This is a concatenation of blocks: b(-2) = [0], b(-1) = [0], b(0) = [1], b(1) = [3], b(2) = [6 1 6], b(3) = [12 4 12 2 12 0 12], b(4) = [25 10 25 8 25 6 25 4 25 2 25 0 25], ...
EXAMPLE
a(4) = 6, 6-5 = 1 >= 0, so a(5) = 1. 1-6 < 0, so a(6) = 1 + 5 = 6.
When in A091023 we assign b(8) = 11, there are 2 unassigned b's to the left, namely b(3) and b(6) and indeed a(10) = 2.
MATHEMATICA
t={0}; Do[AppendTo[t, If[t[[-1]]-n>=0, t[[-1]]-n, t[[-1]]+n-1]], {n, 1, 69}]; t (* Indranil Ghosh, Feb 22 2017 *)
nxt[{n_, a_}]:={n+1, If[a-n-1>=0, a-n-1, a+n]}; NestList[nxt, {0, 0}, 70][[;; , 2]] (* Harvey P. Dale, Jun 14 2023 *)
PROG
(Python)
print("0 0")
i=1
a=0
if a-i>=0:b=a-i
else:b=a+i-1
while i<=100:
print(str(i)+" "+str(b))
a=b
i+=1
if a-i>=0:b=a-i
else:b=a+i-1 # Indranil Ghosh, Feb 22 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 23 2004
STATUS
approved