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 A056557 #23 Nov 05 2024 05:24:53 %S A056557 0,0,1,1,0,1,1,2,2,2,0,1,1,2,2,2,3,3,3,3,0,1,1,2,2,2,3,3,3,3,4,4,4,4, %T A056557 4,0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,0,1,1,2,2,2,3,3,3,3,4,4, %U A056557 4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5 %N A056557 Second tetrahedral coordinate. %C A056557 If {(X,Y,Z)} are triples of nonnegative integers with X >= Y >= Z ordered by X, Y and Z, then X=A056556(n), Y=A056557(n) and Z=A056558(n). %F A056557 a(n) = floor((sqrt(8*(n-A056556(n)*(A056556(n)+1)*(A056556(n)+2)/6)+1)-1)/2) = A003056(n-A000292(A056556(n)-1)). %F A056557 a(n+1) = 0 if A056556(n) = A056558(n); a(n+1) = a(n)+1 if a(n) = A056558(n); otherwise a(n+1) = a(n). - _Graeme McRae_, Jan 09 2007 %o A056557 (Python) %o A056557 from math import isqrt, comb %o A056557 from sympy import integer_nthroot %o A056557 def A056557(n): return (k:=isqrt(r:=n+1-comb((m:=integer_nthroot(6*(n+1),3)[0])-(n<comb(m+2,3))+2,3)<<1))-((r<<2)<=(k<<2)*(k+1)+1) # _Chai Wah Wu_, Nov 04 2024 %Y A056557 Cf. A000292, A002262, A003056, A056556, A056558, A056559, A056560. %Y A056557 See also A194847, A194848. %K A056557 nonn %O A056557 0,8 %A A056557 _Henry Bottomley_, Jun 26 2000