This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A053616 Pyramidal sequence: distance to nearest triangular number. 4
 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, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,9 LINKS T. D. Noe, Table of n, a(n) for n = 0..1000 EXAMPLE a(12)=|12-10|=2 since 10 is the nearest triangular number to 12 MATHEMATICA a[n_] := (k =.; k = Reduce[k > 0 && k*(k+1)/2 == n, Reals][[2]] // Floor; Min[(k+1)*(k+2)/2 - n, n - k*(k+1)/2]); Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Jan 08 2013 *) Module[{trms=120, t}, t=Accumulate[Range[Ceiling[(Sqrt[8*trms+1]-1)/2]]]; Join[{0}, Flatten[Table[Abs[Nearest[t, n][[1]]-n], {n, trms}]]]] (* Harvey P. Dale, Nov 08 2013 *) PROG (PARI) print1(x=0, ", "); for(stride=1, 13, x+=stride; y=x+stride+1; for(k=x, y-1, print1(min(k-x, y-k), ", "))) \\ Hugo Pfoertner, Jun 02 2018 CROSSREFS Cf. A000217, A002262, A053188. a(n) = abs(A305258(n)). Sequence in context: A114021 A239287 A305258 * A094718 A076191 A282318 Adjacent sequences:  A053613 A053614 A053615 * A053617 A053618 A053619 KEYWORD easy,nice,nonn AUTHOR Henry Bottomley, Mar 20 2000 STATUS approved

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