OFFSET
0,3
COMMENTS
See A194847.
REFERENCES
D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.3, Eq. (20), p. 360.
LINKS
Chai Wah Wu, Algorithms for Complementary Sequences, Integers (2025) Vol. 25, Art. No. A95. See p. 22.
FORMULA
Equals A056557(n) + 1.
MAPLE
See A194847.
PROG
(Python)
from math import isqrt, comb
from sympy import integer_nthroot
def A194848(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
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 03 2011
STATUS
approved
