login
A088673
a(n) = n mod A002024(n), where A002024 is "n appears n times": 1, 2, 2, 3, 3, 3, ...
1
0, 0, 1, 1, 2, 0, 3, 0, 1, 2, 1, 2, 3, 4, 0, 4, 5, 0, 1, 2, 3, 1, 2, 3, 4, 5, 6, 0, 5, 6, 7, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7, 8, 0, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 8, 9, 10, 11, 12, 13, 0, 1, 2
OFFSET
1,5
EXAMPLE
a(7) = 3: A002024(7) = 4 and 7 mod 4 = 3.
MATHEMATICA
Table[Mod[n, Floor[1/2+Sqrt[2n]]], {n, 100}] (* Harvey P. Dale, Feb 09 2013 *)
PROG
(Python)
from math import isqrt
def A088673(n): return n%((m:=isqrt(k:=n<<1))+(k>m*(m+1))) # Chai Wah Wu, Nov 07 2024
CROSSREFS
Cf. A002024.
Sequence in context: A160271 A274912 A065134 * A339662 A336316 A362110
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Oct 04 2003
EXTENSIONS
Corrected and extended by Ray Chandler, Oct 04 2003
Corrected offset by Chai Wah Wu, Nov 07 2024
STATUS
approved