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:GFN factorization"

From Prime-Wiki
Jump to: navigation, search
(new)
 
(composite without link but sub-digits)
 
(5 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
<nowiki>{{GFN factorization|Generalized Fermat number 2 1 38}}</nowiki> gives
 
<nowiki>{{GFN factorization|Generalized Fermat number 2 1 38}}</nowiki> gives
 
:{{GFN factorization|Generalized Fermat number 2 1 38}}
 
:{{GFN factorization|Generalized Fermat number 2 1 38}}
 +
 +
<nowiki>{{GFN factorization|Generalized Fermat number 2 1 7}}</nowiki> gives
 +
:{{GFN factorization|Generalized Fermat number 2 1 7}}
 
[[Category:Prime collections]]</noinclude><includeonly>{{#vardefine:facts|}}{{#arraydefine:GFNlist|{{GP|{{{1}}}|GFNFactors}}|/\n/}}{{#loop:i|0|{{#arraysize:GFNlist}}
 
[[Category:Prime collections]]</noinclude><includeonly>{{#vardefine:facts|}}{{#arraydefine:GFNlist|{{GP|{{{1}}}|GFNFactors}}|/\n/}}{{#loop:i|0|{{#arraysize:GFNlist}}
 
|<nowiki />
 
|<nowiki />
Line 12: Line 15:
 
-->{{#vardefine:n|{{#explode:{{#explode:{{#arrayindex:GFNlist|{{#var:i}}}}|,|1}}|#|0}}}}<!--
 
-->{{#vardefine:n|{{#explode:{{#explode:{{#arrayindex:GFNlist|{{#var:i}}}}|,|1}}|#|0}}}}<!--
 
-->{{#switch:{{#sub:{{#var:k}}|0|1}}
 
-->{{#switch:{{#sub:{{#var:k}}|0|1}}
|C|P={{#if:{{#var:n}}|{{#vardefine:facts|{{#var:facts}} * [http://factordb.com/index.php?id={{#var:n}} {{#var:k}}]}}|{{#vardefine:facts|{{#var:facts}} * {{#var:k}}}}}}
+
|C|P={{#vardefine:digits|{{#sub:{{#var:k}}|1}}}}{{#if:{{#var:n}}|{{#vardefine:facts|{{#var:facts}} * {{#sub:{{#var:k}}|0|1}}<sub><{{#var:digits}}></sub>}}|{{#vardefine:facts|{{#var:facts}} * {{#sub:{{#var:k}}|0|1}}<sub><{{#var:digits}}></sub>}}}}
|#default={{#if:{{#var:n}}|{{#ifexist:GF Divisor {{#var:k}} {{#var:n}}|{{#vardefine:factn|{{GP|GF Divisor {{#var:k}} {{#var:n}}|GFNumber}}}}{{#if:{{#var:factn}}|{{#vardefine:facts|{{#var:facts}} * {{#var:factn}}}}}}}}|{{#vardefine:facts|{{#var:facts}} * {{#var:k}}}}}}}}}}{{#vardefine:facts|{{#sub:{{#var:facts}}|2}}}}{{#var:facts}}</includeonly>
+
|N={{#ifexist:GF Divisor {{Long number:{{#var:k}}-NS}} {{#var:n}}|{{#vardefine:factn|{{GP|GF Divisor {{Long number:{{#var:k}}-NS}} {{#var:n}}|GFNumber}}}}{{#vardefine:facts|{{#var:facts}} * {{#ifeq:{{#sub:{{#var:factn}}|0|1}}|N|{{Long number:{{#var:factn}}-NL}}<sub><{{Long number:{{#var:factn}}-DI}}></sub>|{{#var:factn}}<sub><{{#len:{{#var:factn}}}}></sub>}}}}
 +
}}
 +
|#default={{#if:{{#var:n}}|{{#ifexist:GF Divisor {{#var:k}} {{#var:n}}|{{#vardefine:factn|{{GP|GF Divisor {{#var:k}} {{#var:n}}|GFNumber}}}}{{#if:{{#var:factn}}|{{#ifeq:{{#sub:{{#var:factn}}|0|1}}|P|{{#vardefine:facts|{{#var:facts}} * P<sub><{{#sub:{{#var:factn}}|1}}></sub>}}|{{#vardefine:facts|{{#var:facts}} * {{#ifeq:{{#sub:{{#var:factn}}|0|1}}|N|{{Long number:{{#var:factn}}-NL}}|{{#var:factn}}}}{{#ifexpr:{{#len:{{#var:factn}}}}>9|<sub><{{#ifeq:{{#sub:{{#var:factn}}|0|1}}|N|{{Long number:{{#var:factn}}-DI}}|{{#len:{{#var:factn}}}}}}></sub>}}}}}}}}|{{#vardefine:facts|{{#var:facts}} * {{#var:k}}}}}}|{{#vardefine:facts|{{#var:facts}} * {{#var:k}}}}}}}}}}{{#vardefine:facts|{{#sub:{{#var:facts}}|2}}}}{{#var:facts}}</includeonly>

Latest revision as of 17:35, 19 August 2021

Purpose

Explanations

Example

{{GFN factorization|Generalized Fermat number 2 1 38}} gives

6597069766657<13> * 2917004348489729<16>

{{GFN factorization|Generalized Fermat number 2 1 7}} gives

59649589127497217<17> * 5704689200685129054721<22>