OFFSET
0,5
COMMENTS
a(n)=0 for n = 0, 3, 20, 119, 696, 4059, 23660, 137903, 803760, ..., . A001652
a(n)=1 for n = 1, 2, 6, 10, 13, 37, 61, 78, 218, 358, 457, 1273, 2089, 2666, 7422, ..., .
a(n)=2 for n = 4, 7, 27, 44, 160, 259, 935, 1512, 5452, 8815, ..., .
a(n)=3 for n = 5, 9, 17, 30, 54, 102, 177, 317, 597, 1034, 1850, 3482, 6029, 10785, ..., .
a(n)=4 for n = 16, 23, 95, 136, 556, 795, 3243, 4636, ..., .
a(n)=5 for n = 14, 34, 85, 201, 498, 1174, 2905, 6845, ..., .
a(n)=6 for n = 8, 11, 12, 24, 47, 51, 68, 71, 143, 276, 300, 399, 416, 836, 1611, ..., .
First occurrence of k beginning with 0, or -1 if no such value is known: 0, 1, 4, 5, 16, 14, 8, -1, 19, 21, 15, 18, 75, 22, 28, 29, ..., .
Values that appear to be missing in the sequence: 7, 18, 23, 31, 37, 38, 40, 47, 52, 59, 67, 68, 70, 73, 83, 86, 88, 92, 98, 102, ..., .
Sequence records by value: 0, 1, 2, 3, 6, 10, 11, 13, 17, 22, 24, 27, 35, 36, 45, 49, 54, 63,. 74,. 75,. 82,. 90, ..., .
Sequence records by index: 0, 1, 4, 5, 8, 15, 18, 22, 25, 32, 39, 42, 49, 56, 66, 73, 83, 90, 107, 114, 124, 131, ..., .
EXAMPLE
a(0)=0
a(1)=1
a(2)=1=2-1
a(3)=0=3-(2+1)
a(4)=2=|4-(3+2+1)|
a(5)=3=5+4-(3+2+1)
a(6)=1=6+5-(4+3+2+1)
a(7)=2=7+6-(5+4+3+2+1)
a(8)=6=8+7+6-(5+4+3+2+1)
MATHEMATICA
tri[n_] := n (n + 1)/2; f[n_] := Block[{d, k = 0, mx = Infinity}, While[k < n + 1, d = Abs[ tri@n - 2 tri@k]; If[d < mx, mx = d]; k++ ]; mx]; Array[f, 100, 0]
Join[{0}, Table[Min[Flatten[Table[Abs[Differences[(Total/@TakeDrop[Range[n], k])]], {k, n}]]], {n, 90}]] (* Harvey P. Dale, Mar 08 2023 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Oct 08 2010
STATUS
approved