login
A396346
a(0) = 0; for n > 0, a(n) = a(n-1) - n if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + n - 1.
4
0, 0, 1, 3, 6, 10, 4, 10, 2, 10, 19, 8, 19, 31, 17, 31, 15, 31, 13, 31, 11, 31, 9, 31, 7, 31, 5, 31, 58, 29, 58, 27, 58, 25, 58, 23, 58, 21, 58, 96, 56, 96, 54, 96, 52, 96, 50, 96, 48, 96, 46, 96, 44, 96, 42, 96, 40, 96, 38, 96, 36, 96, 34, 96, 32, 96, 30, 96, 28, 96, 26, 96, 24
OFFSET
0,4
COMMENTS
Every natural number appears in the sequence for n >= 2. Specifically, any natural number that is not a term of A396345 appears exactly once, while the terms of A396345 appear at least once.
LINKS
FORMULA
For n >= 3, a(n) = A396345(m) if n - m == 0 mod 2, and a(n) = A396345(m) - n otherwise, where m is the unique index satisfying A396344(m) <= n < A396344(m+1).
EXAMPLE
m | a(n) for A396344(m) <= n < A396344(m+1)
----+--------------------------------------------------------------------------------
- | 0, 0, 1 (for n = 0, 1, 2)
1 | 3;
2 | 6;
3 | 10, 4, 10, 2, 10;
4 | 19, 8, 19;
5 | 31, 17, 31, 15, 31, 13, 31, 11, 31, 9, 31, 7, 31, 5, 31;
6 | 58, 29, 58, 27, 58, 25, 58, 23, 58, 21, 58;
7 | 96, 56, 96, 54, 96, 52, 96, 50, 96, 48, 96, 46, 96, 44, 96, ... , 96;
8 | 181, 94, 181, 92, 181, 90, 181, 88, 181, 86, 181, 84, 181, 82, 181, ... , 181;
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Seiichi Manyama, May 23 2026
STATUS
approved