This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A355182 #49 Jul 20 2022 22:37:52 %S A355182 1,1,4,3,1,6,3,10,6,1,10,4,15,8,21,13,4,19,9,26,15,3,22,9,30,16,1,24, %T A355182 8,33,16,43,25,6,35,15,46,25,3,36,13,48,24,61,36,10,49,22,63,35,6,49, %U A355182 19,64,33,1,48,15,64,30,81,46,10,63,26,81,43,4,61,21,80,39,100,58,15,78,34,99 %N A355182 a(n) = t(n) - s(n) where s(n) = n*(n-1)/2 is the sum of the first n nonnegative integers and t(n) is the smallest sum of consecutive integers starting from n such that t(n) > s(n). %C A355182 Record high values of a(n)/n approach sqrt(2) and occur at values of n that are terms of A011900; a(A011900(k)) = A046090(k). - _Jon E. Schoenfield_, Jun 23 2022 %C A355182 It appears that the sequence 1,2,4,5,6,8,... (the largest integer in the t(n) sum) is A288998. - _Michel Marcus_, Jun 24 2022 %F A355182 From _Jon E. Schoenfield_, Jun 23 2022: (Start) %F A355182 a(n) = t(n) - s(n) where %F A355182 s(n) = n*(n-1)/2, %F A355182 j = floor(sqrt(8*n^2 - 8*n + 1)), %F A355182 m = ceiling(j/2) - n + 1, and %F A355182 t(n) = (m*(m + 2*n - 1))/2. (End) %e A355182 a(6) = -s(6) + t(6): %e A355182 s(6) is the sum of the first 6 nonnegative integers = 6*5 / 2 = 15. %e A355182 t(6) is the smallest sum k of consecutive integers starting from n = 6 such that k > s(6) = 15. %e A355182 The first few sets of consecutive integers starting from 6 are %e A355182 {6}, whose elements add up to 6, %e A355182 {6, 7}, whose elements add up to 13, %e A355182 {6, 7, 8}, whose elements add up to 21, %e A355182 {6, 7, 8, 9}, whose elements add up to 30, %e A355182 ... %e A355182 the smallest sum that is > 15 is 21, so t(6) = 21, so a(6) = -15 + 21 = 6. %o A355182 (JavaScript) %o A355182 function a(n) { %o A355182 var sum = 0; %o A355182 for (var i = 0; i < n; i++) %o A355182 sum -= i; %o A355182 while (sum <= 0) %o A355182 sum += i++; %o A355182 return sum; %o A355182 } %o A355182 (PARI) a(n) = my(t=0, s=n*(n-1)/2, k=n); until (t > s, t += k; k ++); t-s; \\ _Michel Marcus_, Jun 24 2022 %o A355182 (Python) %o A355182 from math import isqrt %o A355182 def A355182(n): return ((m:=(isqrt(((k:=n*(n-1))<<3)+1)+1)>>1)*(m+1)>>1)-k # _Chai Wah Wu_, Jul 14 2022 %Y A355182 Cf. A000217, A001477, A093001. %Y A355182 Cf. A288998. %K A355182 nonn %O A355182 1,3 %A A355182 _Andrea La Rosa_, Jun 23 2022