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:NVal"
(new) |
|||
Line 1: | Line 1: | ||
− | < | + | <noinclude> |
− | < | + | ==Purpose== |
+ | Displays a value given in a list of numbers with different options which are seperated by {{Key|;}}. | ||
+ | |||
+ | ==Options== | ||
+ | #{{Key|n-value}}: only the value is displayed | ||
+ | #{{Key|n-value;Top5000-ID}}: the n-value is given with a link to the [[The Prime Pages]] | ||
+ | #{{Key|n-value;T:<type/s>}}: the n-value is given with a special type | ||
+ | ::types are denoted as | ||
+ | ::T: [[Twin prime]] | ||
+ | ::W: [[Woodall number|(generalized) Woodall prime]] | ||
+ | ::C: [[Cullen number|(generalized) Cullen prime]] | ||
+ | ::S: [[Sophie Germain prime]] | ||
+ | #<li value="4">{{Key|n-value;C:<any comment to this value>}}: given a comment can contain page links and wiki syntax</li> | ||
+ | |||
+ | A combination of these options i possible, but | ||
+ | *only the n-value is recommended | ||
+ | *the second parameter can only be the Top5000 ID | ||
+ | *other special types as given will displays as "ERR" | ||
+ | |||
+ | Every "T:" or "C:" value given will be displayed as a text reference | ||
+ | |||
+ | ==Examples== | ||
+ | <pre> | ||
+ | 12345 | ||
+ | 631;T:TC;C:Test | ||
+ | 653490;121779;T:TX | ||
+ | 688042;121867;T:CTW | ||
+ | 678901;121905;C:Divides: F(33) | ||
+ | 695631;121906;T:WTC;C:[[Test]]<br>'''Divides:''' F(38), GF(38,3), GF(33,6), GF(38,12) | ||
+ | </pre> | ||
+ | |||
+ | produces the following outputs (with the notes at the bottom of this page): | ||
+ | *{{NVal|12345}} | ||
+ | *{{NVal|631;T:TC;C:Test}} | ||
+ | *{{NVal|653490;121779;T:TX}} | ||
+ | *{{NVal|688042;121867;T:CTW}} | ||
+ | *{{NVal|678901;121905;C:Divides: F(33)}} | ||
+ | *{{NVal|695631;121906;T:WTC;C:[[Test]]<br>'''Divides:''' F(38), GF(38,3), GF(33,6), GF(38,12)}} | ||
+ | |||
+ | ==Notes== | ||
+ | [[Category:Templates]] | ||
+ | </noinclude><includeonly>{{#arraydefine:nvals|{{{1}}}|;}}{{#vardefine:c1|}}{{#vardefine:c2|}}{{#vardefine:cres|}}{{#loop:i | ||
+ | |0 | ||
+ | |{{#arraysize:nvals}} | ||
+ | |<nowiki /><!-- | ||
+ | -->{{#vardefine:part|{{#arrayindex:nvals|{{#var:i}}}}}}<!-- | ||
+ | -->{{#ifeq:{{#var:i}}|0|{{#vardefine:num|{{#var:part}}}}}}<!-- | ||
+ | -->{{#ifeq:{{#var:i}}|1|{{#iferror:{{#expr:{{#var:part}}+1}}||{{#vardefine:num|{{PP|{{#var:part}}|{{#var:num}}}}}}}}}}<!-- | ||
+ | -->{{#if:{{#pos:{{#var:part}}|C:}}|{{#vardefine:c2|{{#sub:{{#var:part}}|2}}}}}}<!-- | ||
+ | -->{{#if:{{#pos:{{#var:part}}|T:}}| | ||
+ | {{#loop: j | ||
+ | |2 | ||
+ | |{{#expr:{{#len:{{#var:part}}}}-2}} | ||
+ | |<nowiki /><!-- | ||
+ | -->{{#switch:{{#sub:{{#var:part}}|{{#var:j}}|1}} | ||
+ | |C={{#vardefine:cnt|Cullen}} | ||
+ | |W={{#vardefine:cnt|Woodall}} | ||
+ | |T={{#vardefine:cnt|Twin}} | ||
+ | |S={{#vardefine:cnt|Sophie-Germain}} | ||
+ | |#default={{#vardefine:cnt|ERR}} | ||
+ | }}<!-- | ||
+ | -->{{#if:{{#var:c1}}|{{#vardefine:c1|{{#var:c1}},<nowiki> </nowiki>{{#var:cnt}}}}|{{#vardefine:c1|{{#var:cnt}}}}<!-- | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- | ||
+ | -->}} | ||
+ | }}{{#var:num}}{{#vardefine:cres|{{#if:{{#var:c1}}|{{#var:c1}}}}{{#if:{{#var:c2}}|{{#if:{{#var:c1}}|,<nowiki> </nowiki>}}{{#var:c2}}}}}}{{#if:{{#var:cres}}|{{#tag:ref|{{#var:cres}}}}}}</includeonly> |
Revision as of 13:47, 25 March 2019
Contents
Purpose
Displays a value given in a list of numbers with different options which are seperated by ;.
Options
- n-value: only the value is displayed
- n-value;Top5000-ID: the n-value is given with a link to the The Prime Pages
- n-value;T:<type/s>: the n-value is given with a special type
- types are denoted as
- T: Twin prime
- W: (generalized) Woodall prime
- C: (generalized) Cullen prime
- S: Sophie Germain prime
- n-value;C:<any comment to this value>: given a comment can contain page links and wiki syntax
A combination of these options i possible, but
- only the n-value is recommended
- the second parameter can only be the Top5000 ID
- other special types as given will displays as "ERR"
Every "T:" or "C:" value given will be displayed as a text reference
Examples
12345 631;T:TC;C:Test 653490;121779;T:TX 688042;121867;T:CTW 678901;121905;C:Divides: F(33) 695631;121906;T:WTC;C:[[Test]]<br>'''Divides:''' F(38), GF(38,3), GF(33,6), GF(38,12)
produces the following outputs (with the notes at the bottom of this page):