OFFSET
1,2
COMMENTS
Let {x} denote the fractional part of x. The second nearest integer to x, denoted by s(x), is defined to be ceiling(x) if {x} < 1/2 and floor(x) if {x} >= 1/2. If x is not an integer, there are exactly two integers k such that |k-x|<1; one is round(x) = floor(x+1/2), and the other is s(x).
Let J(n) be the n-th number k for which s((k+1)*r) > s(k*r). The golden ratio appears to be the only number x for which J(n) = floor(nx) for all n>=0. In this case, J = A000201.
Let f(n) = 0 if a(n) = a(n+1) and f(n) = 1 otherwise; then f is the infinite Fibonacci word A005614 = 1-A003849.
In this sequence, replace each repeated term by 1 and all others by 0; the result is A005713 (prefixed by 0).
The distinct terms of this sequence are given by A007064.
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..10000
EXAMPLE
n . . n*r . . nearest integer . second nearest
1 . . 1.618... . 2 . . . . . . . 1 = a(1)
2 . . 3.236... . 3 . . . . . . . 4 = a(2)
3 . . 4.854... . 5 . . . . . . . 4 = a(3)
4 . . 6.472... . 6 . . . . . . . 7 = a(4)
5 . . 8.090... . 8 . . . . . . . 9 = a(5)
MATHEMATICA
r = GoldenRatio; f[x_] := If[FractionalPart[x] < 1/2, Ceiling[x], Floor[x]]
Table[f[r*n], {n, 1, 100}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Oct 31 2012
STATUS
approved