OFFSET
1,4
COMMENTS
a(n) + b(n) = n and as n -> +infinity, a(n) / b(n) converges to sqrt(2). For all n, a(n) / b(n) < sqrt(2).
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
Heinz H. Bauschke, Minh N. Dao, Scott B. Lindstrom, The Douglas-Rachford algorithm for a hyperplane and a doubleton, arXiv:1804.08880 [math.OC], 2018.
FORMULA
a(1) = 0. b(n) = n - a(n). If (a(n) + 1) / b(n) < sqrt(2), then a(n+1) = a(n) + 1, else a(n+1) = a(n).
a(n) = floor(n*(2-sqrt(2))). - Vladeta Jovovic, Oct 04 2003
a(n) = 2*n - ceiling(n*sqrt(2)). - Clark Kimberling, Sep 09 2011
EXAMPLE
a(6)= 3 so b(6) = 6 - 3 = 3. a(7) = 4 because (a(6) + 1) / b(6) = 4/3 which is < sqrt(2). So b(7) = 7 - 4 = 3. a(8) = 4 because (a(7) + 1) / b(7) = 5/3 which is not < sqrt(2).
MATHEMATICA
Table[Floor[n*(2 - Sqrt[2])], {n, 1, 50}] (* G. C. Greubel, Nov 28 2017 *)
PROG
(PARI) for(n=1, 30, print1(floor(n*(2-sqrt(2))), ", ")) \\ G. C. Greubel, Nov 28 2017
(Magma) [Floor(n*(2-Sqrt(2))): n in [1..30]]; // G. C. Greubel, Nov 28 2017
CROSSREFS
KEYWORD
easy,frac,nonn
AUTHOR
Robert A. Stump (bee_ess107(AT)msn.com), Sep 09 2002
STATUS
approved