login
A393813
Among all the numbers k such that 0 <= k < n and {phi * k} < {phi * n}, a(n) is the one maximizing {phi * k}, where {} denotes the fractional part and phi = A001622.
2
0, 0, 1, 2, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
OFFSET
1,4
COMMENTS
Every nonnegative integer appears infinitely many times in the sequence.
LINKS
FORMULA
Empirically: a(n) = 0 iff n belongs to A001519, a(n) = 1 + a(n-1) otherwise.
EXAMPLE
The first terms are:
n {phi*n} a(n)
-- ------- ----
0 0. N/A
1 0.61... 0
2 0.23... 0
3 0.85... 1
4 0.47... 2
5 0.09... 0
6 0.70... 1
7 0.32... 2
8 0.94... 3
9 0.56... 4
10 0.18... 5
PROG
(PARI) a(n, phi = (1+sqrt(5))/2) = { my (f = frac(phi * n), mx = -oo, v = -oo); for (k = 0, n-1, my (g = frac(phi * k)); if (mx < g && g < f, mx = g; v = k; ); ); return (v); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Apr 10 2026
STATUS
approved