Шаблон:Nums/tests

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску

Основное предназначение шаблона {{nums}}форматирование и вывод нескольких целых чисел, разделённых запятыми, пробелами или другими разделителями. Простейший вариант использования шаблона:

{{nums|1|12|123|1234|12345}}
1, 12, 123, 1234, 12 345

Существует возможность превратить числа в ссылки на статьи о числах:

{{nums|1|12|123|1234|12345|link=nrl}}
1, 12, 123, 1234, 12 345

Можно заменить разделитель (по умолчанию это запятая и пробел):

{{nums|1|12|123|1234|12345|x=+}}
1 + 12 + 123 + 1234 + 12 345
{{nums|1|12|123|1234|12345|x!=.}}
1.12.123.1234.12 345

Можно отдельно изменить последний разделитель:

В десятичной системе счисления [[факторион]]ами являются четыре числа: {{nums|1|2|145|40585|xx=и}}
В десятичной системе счисления факторионами являются четыре числа: 1, 2, 145 и 40 585

Можно вывести заданный текст до и/или после каждого числа:

{{nums|1|12|123|1234|12345|prefix=<|suffix=>}}
<1>, <12>, <123>, <1234>, <12 345>

Базовые варианты

[править код]
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|6|28|496|8128|33550336|8589869056}}
  • то же со ссылками
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|link=yes|6|28|496|8128|33550336|8589869056}}
  • то же без красных ссылок
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|6|28|496|8128|33550336|8589869056|link=nrl}}

Автоматическое форматирование чисел по ВП:Ч

[править код]
  • контрольный пример без пробелов на входе
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|6|28|496|8128|33550336|8589869056}}
  • контрольный пример с принятым форматированием на входе
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|6|28|496|8128|33 550 336|8 589 869 056}}
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|6|28|4 96|8 128|335 50 336|85898 69056}}
  • то же со ссылками
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|link=yes|6|28|4 96|8 128|335 50 336|85898 69056}}
  • то же без красных ссылок
6, 28, 496, 8128, 33 550 336, 8 589 869 056
{{nums|6|28|4 96|8 128|335 50 336|85898 69056|link=nrl}}

Что-то поинтереснее простого перечисления

[править код]
1+2+3+4+5+6+7+8+9+10 = 55
{{nums|x!=+|1|2|3|4|5|6|7|8|9|10}} = 55
  • то же со ссылками
1+2+3+4+5+6+7+8+9+10 = 55
{{nums|x!=+|1|2|3|4|5|6|7|8|9|10|link=yes}} = {{num1|55}}
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55
{{nums|x=+|1|2|3|4|5|6|7|8|9|10}} = 55
  • то же со ссылками
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55
{{nums|x=+|1|2|3|4|5|6|7|8|9|10|link=yes}} = {{num1|55}}
2 × 3 × 5 × 7 × 11 × 13 × 17 × 19 = 9 699 690
{{nums|2|3|5|7|11|13|17|19|x=&times;}} = {{num1|9699690|link=no}}
  • то же со ссылками
2 × 3 × 5 × 7 × 11 × 13 × 17 × 19 = 9 699 690
{{nums|2|3|5|7|11|13|17|19|x=&times;|link=yes}} = {{num1|9699690}}

Префиксы и суффиксы

[править код]
sf(4) = 1! × 2! × 3! × 4! = 288
sf(4) = {{nums|1|2|3|4|x=&times;|suffix=!}} = {{num1|288}}
  • Сумма одинаковых степеней
33 + 43 + 53 = 63
{{nums|3|4|5|suffix=<sup>3</sup>|x=+}} = {{power|6|3}}
  • Разные степени с одним основанием
103 + 104 + 105 = 1000 + 10 000 + 100 000 = 111 000
{{nums|3|4|5|prefix=10<sup>|suffix=</sup>|x=+}} = {{nums|1000|10000|100000|x=+}} = {{num|111000}}
21 + 22 + 23 + 24 = 11 + 22 + 33 + 44 = 288
{{nums|1|2|3|4|x=+|prefix=<sup>2</sup>}} = {{power|1|1}} + {{power|2|2}} + {{power|3|3}} + {{power|4|4}} = {{num1|288}}
  • Кавычки зачем-то понадобились
«23», «317», «1997»
{{nums|23|317|1997|prefix=«|suffix=»}}
  • Кавычки со ссылками
«23», «317», «1997»
{{nums|23|317|1997|prefix=«|suffix=»|link=1}}

natural join (параметры xx, xx!)

[править код]
  • Простые числа, меньшие 20 — числа {{nums|2|3|5|7|11|13|17|19|xx=и}}.
Простые числа, меньшие 20 — числа 2, 3, 5, 7, 11, 13, 17 и 19.
  • Простые числа, меньшие 20 — числа {{nums|2|3|5|7|11|13|17|19|xx=и|link=yes}}.
Простые числа, меньшие 20 — числа 2, 3, 5, 7, 11, 13, 17 и 19.
  • {{nums|3|4|5|6|x=+|suffix=<sup>3</sup>}}.
33 + 43 + 53 + 63.
  • {{nums|3|4|5|6|x!=+|suffix=<sup>3</sup>}}.
33+43+53+63.
  • {{nums|3|4|5|6|xx=+|suffix=<sup>3</sup>}}.
33, 43, 53 + 63.
  • {{nums|3|4|5|6|xx!=+|suffix=<sup>3</sup>}}.
33, 43, 53+63.
  • {{nums|3|4|5|6|x=+|xx={{=}}|suffix=<sup>3</sup>}}.
33 + 43 + 53 = 63.
  • {{nums|3|4|5|6|x!=+|xx!={{=}}|suffix=<sup>3</sup>}}.
33+43+53=63.
  • {{nums|3|4|5|6|x!=+|xx={{=}}|suffix=<sup>3</sup>}}.
33+43+53 = 63.
  • {{nums|3|4|5|6|x=+|xx!={{=}}|suffix=<sup>3</sup>}}.
33 + 43 + 53=63.


(571113), (11131719), (101103107109), (191, 193197199), (821, 823, 827, 829), (1481, 1483, 1487, 1489), (1871, 1873, 1877, 1879), (2081, 2083, 2087, 2089), (3251, 3253, 3257, 3259), …, (25 301, 25 303, 25 307, 25 309), …
({{nums|5|7|11|13|link=nrl|x!=,&nbsp;}}), ({{nums|11|13|17|19|link=nrl|x!=,&nbsp;}}), ({{nums|101|103|107|109|link=nrl|x!=,&nbsp;}}), ({{nums|191|193|197|199|link=nrl|x!=,&nbsp;}}), ({{nums|821|823|827|829|link=nrl|x!=,&nbsp;}}), ({{nums|1481|1483|1487|1489|link=nrl|x!=,&nbsp;}}), ({{nums|1871|1873|1877|1879|link=nrl|x!=,&nbsp;}}), ({{nums|2081|2083|2087|2089|link=nrl|x!=,&nbsp;}}), ({{nums|3251|3253|3257|3259|link=nrl|x!=,&nbsp;}}), …, ({{nums|25301|25303|25307|25309|x!=,&nbsp;}}), …

Сравнение {{nums}} и {{list}}

[править код]
  • Параметр x задан
{{nums}}: 123 foo 456 foo 789
{{list}}: 123 foo 456 foo 789
  • Параметр x пустой
{{nums}}: 123, 456, 789
{{list}}: 123  456  789
  • Параметр x! задан
{{nums}}: 123foo456foo789
{{list}}: 123foo456foo789
  • Параметр x! пустой
{{nums}}: 123456789
{{list}}: 123456789
  • Без этих параметров
{{nums}}: 123, 456, 789
{{list}}: 123 | 456 | 789

Разное число параметров

[править код]
  • 1
  • 1, 2
  • 1, 2, 3
  • 1, 2, 3, 4
  • 1, 2, 3, 4, 5
  • 1, 2, 3, 4, 5, 6
  • 1, 2, 3, 4, 5, 6, 7
  • 1, 2, 3, 4, 5, 6, 7, 8
  • 1, 2, 3, 4, 5, 6, 7, 8, 9
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

«natural join»

[править код]
  • 1
  • 1 и 2
  • 1, 2 и 3
  • 1, 2, 3 и 4
  • 1, 2, 3, 4 и 5
  • 1, 2, 3, 4, 5 и 6
  • 1, 2, 3, 4, 5, 6 и 7
  • 1, 2, 3, 4, 5, 6, 7 и 8
  • 1, 2, 3, 4, 5, 6, 7, 8 и 9
  • 1, 2, 3, 4, 5, 6, 7, 8, 9 и 10
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 и 11
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 и 12
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 и 13
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 и 14
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 и 15
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 и 16
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 и 17
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 и 18
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 и 19
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 и 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

Все основные возможности

[править код]

Предельное число параметров

[править код]
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
  • 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20
  • 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20
  • <1>, <2>, <3>, <4>, <5>, <6>, <7>, <8>, <9>, <10>, <11>, <12>, <13>, <14>, <15>, <16>, <17>, <18>, <19>, <20>