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 list"

From Prime-Wiki
Jump to: navigation, search
m
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
==Purpose==
 
==Purpose==
Displaying a given list of n-values with different options.
+
Displaying a given list of {{Vn}}-values with different options.
  
 
==Parameter==
 
==Parameter==
The first parameter is always the list of n-values, the second can be one of the following:
+
The first parameter is always the list of {{Vn}}-values, the second can be one of the following:
*<count>: only the number of n-values is displayed
+
*<count>: only the number of {{Vn}}-values is displayed
*<short>: only the list of n-values is given without any types/comments
+
*<short>: only the list of {{Vn}}-values is given without any types/comments
*<first>: returns the first entry of the n-values, empty if none
+
*<first>: returns the first entry of the {{Vn}}-values, empty if none
*<last>: returns the last entry of the n-values, empty if none
+
*<last>: returns the last entry of the {{Vn}}-values, empty if none
*none=default: all n-values with types/comments are displayed
+
*none=default: all {{Vn}}-values with types/comments are displayed
  
 
==Examples==
 
==Examples==
Line 25: Line 25:
 
|last={{#arraydefine:n2|{{#arrayindex:nvalues|{{#expr:{{#arraysize:nvalues}}-1}}}}|;}}{{#arrayindex:n2|0}}
 
|last={{#arraydefine:n2|{{#arrayindex:nvalues|{{#expr:{{#arraysize:nvalues}}-1}}}}|;}}{{#arrayindex:n2|0}}
 
|#default={{#loop:i|0|{{#arraysize:nvalues}}|{{#ifeq:{{#var:i}}|0||,&#32;}}<!--
 
|#default={{#loop:i|0|{{#arraysize:nvalues}}|{{#ifeq:{{#var:i}}|0||,&#32;}}<!--
### determine SG for Riesels ###
+
### determine SG for Riesel prime base=2###
-->{{#ifeq:{{#pos:{{PAGENAME}}|Riesel prime}}|0|{{#vardefine:_n1|{{#arrayindex:nvalues|{{#var:i}}}}}}<!--
+
-->{{#ifeq:{{#pos:{{urlencode:{{PAGENAME}}|WIKI}}|{{urlencode:Riesel_prime_2_}}}}|0|{{#vardefine:_n1|{{#arrayindex:nvalues|{{#var:i}}}}}}{{#vardefine:_n11|{{#sub:{{#var:_n1}}|0|{{#pos:{{#var:_n1}}|;}}}}}}<!--
-->{{#vardefine:_n2|{{#arrayindex:nvalues|{{#expr:{{#var:i}}+1}}}}}}<!--
+
-->{{#vardefine:_n2|{{#arrayindex:nvalues|{{#expr:{{#var:i}}+1}}}}}}{{#vardefine:_n22|{{#sub:{{#var:_n2}}|0|{{#pos:{{#var:_n2}}|;}}}}}}<!--
-->{{#ifeq:{{#var:_n2}}|{{#expr:{{#var:_n1}}+1}}|{{#vardefine:_isSG|{{#pos:{{#var:_n1}}|T:S}}}}{{#if:{{#var:_isSG}}||[[Category:Riesel prime missing SG|#.....{{padleft:{{{Rk}}}|5|0}}]]}}}}}}<!--
+
-->{{#ifeq:{{#var:_n22}}|{{#expr:{{#var:_n11}}+1}}|{{#vardefine:_isSG|{{#pos:{{#var:_n1}}|T:S}}}}{{#if:{{#var:_isSG}}||[[Category:Riesel prime missing SG|#.....{{padleft:{{{Rk}}}|5|0}}]]}}}}}}<!--
 
### show list ###
 
### show list ###
 
-->{{NVal|{{#arrayindex:nvalues|{{#var:i}}}}}}}}
 
-->{{NVal|{{#arrayindex:nvalues|{{#var:i}}}}}}}}
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 14:07, 25 July 2021

Purpose

Displaying a given list of n-values with different options.

Parameter

The first parameter is always the list of n-values, the second can be one of the following:

  • <count>: only the number of n-values is displayed
  • <short>: only the list of n-values is given without any types/comments
  • <first>: returns the first entry of the n-values, empty if none
  • <last>: returns the last entry of the n-values, empty if none
  • none=default: all n-values with types/comments are displayed

Examples

{{NVal list|<list>}}: default
{{NVal list|<list>|count}}
{{NVal list|<list>|short}}
{{NVal list|<list>|first}}
{{NVal list|<list>|last}}