A088673 a(n) = n mod A002024(n), where A002024 is "n appears n times": 1, 2, 2, 3, 3, 3, ...
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
Examples
a(7) = 3: A002024(7) = 4 and 7 mod 4 = 3.
Crossrefs
Cf. A002024.
Programs
-
Mathematica
Table[Mod[n,Floor[1/2+Sqrt[2n]]],{n,100}] (* Harvey P. Dale, Feb 09 2013 *)
-
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
Extensions
Corrected and extended by Ray Chandler, Oct 04 2003
Corrected offset by Chai Wah Wu, Nov 07 2024