This site is supported by donations to The OEIS Foundation.

Template:Floor

From OeisWiki
Jump to: navigation, search

The {{floor}} mathematical formatting template and/or mathematical function template gives an HTML+CSS or a LaTeX formatted floor function of an expression and/or the numerical result of the floor of an expression (in which case it must evaluate to a real number).

Usage

{{floor|expression}}

or

{{floor|expression|format}}

where the last argument (format) is from

  • htm: HTML+CSS [single line] (default);
  • HTM: HTML+CSS [multiline];
  • tex: LaTeX [single line];
  • TEX: LaTeX [multiline];
  • #: numerical result.

As an alternative to using LaTeX rendered PNG images (tex or TEX options), the htm or HTM options will produce an HTML+CSS formatted expression. (Do not use inside the <math>...</math> tags.)

NOTE: To get rendered LaTeX, you must use the {{math}} template, since you cannot evaluate templates, parser functions or magic words inside the <math>...</math> tags.

Examples

The code : before {{math|{{floor}}|&}} after yields the text style HTML+CSS

before 
⌊ ·⌋
after

The code : before {{math|{{floor|HTM}}|&}} after yields the text style HTML+CSS

before 
·
after

The code : before {{math|{{floor|tex}}|$}} after yields the text style LaTeX

before after

The code : before {{math|{{floor|TEX}}|$}} after yields the text style LaTeX

before after

The code : before {{math|{{floor|''x''}}|&}} after yields the text style HTML+CSS

before 
⌊  x
after

The code : before {{math|{{floor|''x''|HTM}}|&}} after yields the text style HTML+CSS

before 
x
after

The code : before {{math|{{floor|''x''|tex}}|$}} after yields the text style LaTeX

before after

The code : before {{math|{{floor|''x''|TEX}}|$}} after yields the text style LaTeX

before after


The code {{math|{{floor|''x''}}|&&}} yields the display style HTML+CSS

     
⌊  x

The code {{math|{{floor|''x''|HTM}}|&&}} yields the display style HTML+CSS

     
x

The code {{math|{{floor|''x''|tex}}|$$}} yields the display style LaTeX

     

The code {{math|{{floor|''x''|TEX}}|$$}} yields the display style LaTeX

     


The code : before {{math|{{floor|5.3}} {{=}} {{floor|5.3|#}}|&}} after yields the text style HTML+CSS

before 
⌊  5.3⌋
= 5
after

The code : before {{math|{{floor|5.3|HTM}} {{=}} {{floor|5.3|#}}|&}} after yields the text style HTML+CSS

before 
5.3
= 5
after

The code : before {{math|{{floor|5.3|tex}} {{=}} {{floor|5.3|#}}|$}} after yields the text style LaTeX

before after

The code : before {{math|{{floor|5.3|TEX}} {{=}} {{floor|5.3|#}}|$}} after yields the text style LaTeX

before after


The code {{indent}}{{math|{{floor|5.3}} {{=}} {{floor|5.3|#}}|&&}} yields the display style HTML+CSS

     
⌊  5.3⌋
= 5

The code {{indent}}{{math|{{floor|5.3|HTM}} {{=}} {{floor|5.3|#}}|&&}} yields the display style HTML+CSS

     
5.3
= 5

The code {{indent}}{{math|{{floor|5.3|tex}} {{=}} {{floor|5.3|#}}|$$}} yields the display style LaTeX

     

The code {{indent}}{{math|{{floor|5.3|TEX}} {{=}} {{floor|5.3|#}}|$$}} yields the display style LaTeX

     

Willans’s formula

Starting from Wilson’s theorem, C. P. Willans derived the following formula for the
n
th prime[1][2]

The code

{{indent}}{{math|
''p''{{sub|''n''|HTM}} {{=}} 1 + <!--

-->{{sum|''m''{{=}}1|2{{^|''n''|80%}}|HTM}}<!--
  -->{{floor|<!--
    -->{{root|''n''|<big>''n''</big>}} <!--

    -->{{(|<!--
      -->{{sum|''x''{{=}}1|''m''|HTM}}<!--
        -->{{floor|cos{{^|2}} {{Gr|pi}} {{frac|(''x'' {{op|-}} 1)! + 1|''x''|HTM}}|HTM}}{{nbsp}}<!--
    -->|)}}{{^|{{^|{{^|{{op|-}}1{{op|/}}''n''}}|100%}}|100%}} 
     |HTM}}.
| tex = p_n = 1 + \sum_{m=1}^{2^n} {{floor| \sqrt[n]{n} \left( \sum_{x=1}^{m} {{floor| \cos^2 \pi \frac{(x-1)! + 1}{x} |TEX}} \right)^{-1/n } |TEX}} .
|&&}}

yields the display style HTML+CSS

     
pn = 1 +
2n
m  = 1
  
n  n
m
x  = 1
  
cos 2 π
(x − 1)! + 1
x
 
  − 1 / n
.

and, with the $$ argument to {{math}}, yields the display style LaTeX

     

See also

Notes

  1. Henry S. Warren, Hacker’s Delight, Addison-Wesley Professional (2003), p.273.
  2. Willans’s formulas