cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A194733 Number of k < n such that {k*r} > {n*r}, where { } = fractional part, r = (1+sqrt(5))/2 (the golden ratio).

Original entry on oeis.org

0, 1, 0, 2, 4, 1, 4, 0, 4, 8, 2, 7, 12, 4, 10, 1, 8, 15, 4, 12, 0, 9, 18, 4, 14, 24, 8, 19, 2, 14, 26, 7, 20, 33, 12, 26, 4, 19, 34, 10, 26, 1, 18, 35, 8, 26, 44, 15, 34, 4, 24, 44, 12, 33, 0, 22, 44, 9, 32, 55, 18, 42, 4, 29, 54, 14, 40, 66, 24, 51, 8, 36, 64, 19, 48, 2, 32
Offset: 1

Views

Author

Clark Kimberling, Sep 02 2011

Keywords

Comments

The maximum possible value of a(n) is n-1. - Michael B. Porter, Jan 29 2012

Examples

			r = 1.618, 2r = 3.236, 3r = 4.854, and 4r = 6.472, where r=(1+sqrt(5))/2.  The fractional part of 4r is 0.472, which is less than the fractional parts of two of {r, 2r, 3r}, so a(4) = 2. - _Michael B. Porter_, Jan 29 2012
		

Crossrefs

Programs

  • Haskell
    a194733 n = length $ filter (nTau <) $
                map (snd . properFraction . (* tau) . fromInteger) [1..n]
       where (_, nTau) = properFraction (tau * fromInteger n)
             tau = (1 + sqrt 5) / 2
    -- Reinhard Zumkeller, Jan 28 2012
  • Maple
    Digits := 100;
    A194733 := proc(n::posint)
        local a,k,phi,kfrac,nfrac ;
        phi := (1+sqrt(5))/2 ;
        a :=0 ;
        nfrac := n*phi-floor(n*phi) ;
        for k from 1 to n-1 do
            kfrac := k*phi-floor(k*phi) ;
            if evalf(kfrac-nfrac)  > 0 then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    seq(A194733(n),n=1..100) ;  # R. J. Mathar, Aug 13 2021
  • Mathematica
    r = GoldenRatio; p[x_] := FractionalPart[x];
    u[n_, k_] := If[p[k*r] <= p[n*r], 1, 0]
    v[n_, k_] := If[p[k*r] > p[n*r], 1, 0]
    s[n_] := Sum[u[n, k], {k, 1, n}]
    t[n_] := Sum[v[n, k], {k, 1, n}]
    Table[s[n], {n, 1, 100}]  (* A019587 *)
    Table[t[n], {n, 1, 100}]  (* A194733 *)

Formula

a(n)+A019587(n)=n.