login
A309714
The smallest possible nonnegative difference between the sum of the first n positive integers (A000217) and the sum of any number of the directly following and consecutive integers.
1
1, 0, 2, 5, 2, 6, 1, 6, 12, 5, 12, 3, 11, 0, 9, 19, 6, 17, 2, 14, 27, 10, 24, 5, 20, 36, 15, 32, 9, 27, 2, 21, 41, 14, 35, 6, 28, 51, 20, 44, 11, 36, 1, 27, 54, 17, 45, 6, 35, 65, 24, 55, 12, 44, 77, 32, 66, 19, 54, 5, 41, 78, 27, 65, 12, 51, 91, 36, 77, 20, 62
OFFSET
1,3
COMMENTS
a(n) = 0 if a positive integer m exists, such that m * (m + 1) = 2 * n * (n + 1). Let k = m - n, then n = (2 * k - 1 + sqrt(8 * k^2 + 1)) / 2. All k for which 8 * k^2 + 1 is a perfect square (A001109) yield a value for n for which a(n) = 0.
a(A053141(n)) = 0 for all n.
EXAMPLE
a(2) = 1 + 2 - 3 = 0;
a(3) = 1 + 2 + 3 - 4 = 2;
a(7) = 1 + 2 + 3 + 4 + 5 + 6 + 7 - (8 + 9 + 10) = 1.
a(A053141(2)) = a(14) = 0, because A000217(20) = 2 * A000217(14).
PROG
(PARI) a(n) = {my(t=n*(n+1)/2, k = n+1); while(t >= k, t -= k; k++); t; } \\ Michel Marcus, Aug 16 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Bob Andriesse, Aug 13 2019
STATUS
approved