OFFSET
0,2
COMMENTS
Let m be the largest number such that n >= m(m+1). If n is even, a(n) = n - m; otherwise a(n) = n + m + 1.
LINKS
PROG
(Haskell)
a127367 n | even n = n - m + 1
| otherwise = n + m
where m = length $ takeWhile (<= n) a002378_list
-- Reinhard Zumkeller, Oct 12 2011
(Python)
from math import isqrt
def A127367(n): return n+((isqrt((n<<2)|1)-1>>1)+1 if n&1 else -(isqrt((n<<2)|1)-1>>1)) # Chai Wah Wu, Feb 13 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Jan 11 2007
STATUS
approved
