Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3).
Navigation
Topics Help • Register • News • History • How to • Sequences statistics • Template prototypes

Difference between revisions of "Template:Kbn"

From Prime-Wiki
Jump to: navigation, search
(new)
 
m
Line 31: Line 31:
 
|1=2<sup>{{{1}}}</sup>-1
 
|1=2<sup>{{{1}}}</sup>-1
 
|2={{#ifeq:{{{1}}}|+|2<sup>{{{2}}}</sup>+1|{{{1}}} &times; 2<sup>{{{2}}}</sup>-1}}
 
|2={{#ifeq:{{{1}}}|+|2<sup>{{{2}}}</sup>+1|{{{1}}} &times; 2<sup>{{{2}}}</sup>-1}}
|3={{#ifeq:{{{1}}}|+| {{{2}}} &times; 2<sup>{{{3}}}</sup>+1|{{#ifexpr:{{{1}}}>1|{{{1}}} &times;&nbsp;}}{{{2}}}<sup>{{{3}}}</sup>-1}}
+
|3={{#ifeq:{{{1}}}|+|{{{2}}} &times; 2<sup>{{{3}}}</sup>+1|{{#ifexpr:{{{1}}}>1|{{{1}}} &times;&nbsp;}}{{{2}}}<sup>{{{3}}}</sup>-1}}
 
|4={{#ifexpr:{{{2}}}>1|{{{2}}} &times;&nbsp;}}{{{3}}}<sup>{{{4}}}</sup>+1}}</includeonly>
 
|4={{#ifexpr:{{{2}}}>1|{{{2}}} &times;&nbsp;}}{{{3}}}<sup>{{{4}}}</sup>+1}}</includeonly>

Revision as of 10:23, 11 March 2019

Purpose

Display numbers of the form k × bn±1 in text-mode.

Usage

This templates uses one to four unnamed parameters which are defined as follows:

  • Only if the first parameter is +, the '+'-value is displayed, otherwise the '-'-value of the number.

Three more parameters cotaining numbers can be given and used as follows:

  • one parameter: the n-value is given and displays as 2n±1
  • two parameters: the k- and n-values are given and display as k × 2n±1
  • three parameters: the k-, b, and n-values are given and display as k × bn±1

Examples

  • 1 parameter: {{Kbn|123}}: 2123-1
  • 2 parameters: {{Kbn|3|123}}: 3•2123-1
  • 3 parameters: {{Kbn|3|5|123}}: 3•5123-1

With '+'-sign:

  • {{Kbn|+|123}}: 2123+1
  • {{Kbn|+|13|123}}: 13•2123+1
  • {{Kbn|+|3|5|123}}: 3•5123+1

Others:

  • To display only 10123+1, set the k-value to '1': {{Kbn|+|1|10|123}} (or {{Kbn|1|10|123}} to get 10123-1).

Also possible:

  • {{Kbn|2<sup>n</sup>}}: 22n-1
  • {{Kbn|+|2<sup>11</sup>}}: 2211+1