This site is supported by donations to The OEIS Foundation.

Template:Totient

From OeisWiki
Jump to: navigation, search
The following documentation is located at Template:Totient/doc.

The {{totient}} arithmetic function template returns Euler's totient function of (Euler's phi function of , ) of a nonzero integer, otherwise returns an error message.

Usage

{{totient|a nonzero integer}}

or

{{Euler phi|a nonzero integer}}

Valid input

A nonzero integer less than 1031 2 = 1062961 (validation is done by the {{mpf}} arithmetic function template).

Examples

Examples with valid input (check with https://oeis.org/A000010/b000010.txt Table of n, phi(n) for n = 1..100000)

Unfortunately, with the transclusion of {{totient/doc}} via the {{documentation}} template the precious limited nesting levels of templates and/or parser functions were exhausted! :-( Check {{totient/doc}} directly to see that all the tests are successful. Fortunately, by transcluding {{totient/doc}} directly, borrowing the minimum code needed here from the {{documentation}} template, we manage to not exhaust the limit! :-)

Code Result
{{Euler phi|210^2}} 10080
{{totient|210^2}} 10080
{{totient|-28}} 12
{{totient|-5}} 4
{{totient|1}} 1
{{totient|7}} 6
{{totient|15}} 8
{{totient|27}} 18
{{totient|30}} 8
{{totient|111}} 72
{{totient|5^3 * 11^2}} 11000
{{totient|2^5 * 3^3 * 5}} 1152
{{totient|2^9 * 3^3}} 4608
{{totient|37^2 + 8 * 37^2}} 7992
{{totient|2^9 * (26 + 1)}} 4608
{{totient|89 * 113}} 9856
{{totient|79 * 79}} 6162
{{totient|210^2}} 10080
{{totient|233^2}} 54056
{{totient|10000}} 4000
{{totient|65535}} 32768
{{totient|65536}} 32768
{{totient|65537}} 65536
{{totient|65539}} 65538
{{totient|65540}} 25088
{{totient|65541}} 37440
{{totient|65542}} 32770
{{totient|65543}} 65542
{{totient|65547}} 43692
{{totient|65549}} 58000
{{totient|65551}} 65550
{{totient|65553}} 43700
{{totient|65557}} 65556
{{totient|65559}} 39360
{{totient|65561}} 64272
{{totient|65563}} 65562
{{totient|65567}} 65016
{{totient|65569}} 48384
{{totient|65571}} 39720
{{totient|65573}} 62700
{{totient|65577}} 43716
{{totient|65579}} 65578
{{totient|265535}} 203104
{{totient|265536}} 88320
{{totient|265537}} 263380
{{totient|265539}} 177024
{{totient|265540}} 89600
{{totient|265541}} 265540
{{totient|265542}} 88512
{{totient|265543}} 265542
{{totient|265547}} 265546
{{totient|265549}} 258336
{{totient|265551}} 148320
{{totient|265553}} 256368
{{totient|265557}} 161280
{{totient|265559}} 223416
{{totient|265561}} 265560
{{totient|265563}} 167616
{{totient|265567}} 265566
{{totient|265569}} 177044
{{totient|265571}} 265570
{{totient|265573}} 206880
{{totient|265577}} 236880
{{totient|265579}} 265578
{{totient|257}} 256
{{totient|97 * 211}} 20160
{{totient|216 * 211}} 15120
{{totient|1024 * 45}} 12288
{{totient|97 * 257}} 24576
{{totient|3^6 * 5^2}} 9720
{{totient|3 * 5^5}} 5000
{{totient|17^2 * 191}} 51680
{{totient|5 * 7 * 13 * 29}} 8064
{{totient|509^2}} 258572
{{totient|965535}} 505760
{{totient|965536}} 403200
{{totient|965537}} 951060
{{totient|965539}} 953824
{{totient|965540}} 369248
{{totient|965541}} 643692
{{totient|965542}} 457344
{{totient|965543}} 962640
{{totient|965547}} 585000
{{totient|965549}} 835584
{{totient|965551}} 965550
{{totient|965553}} 643700
{{totient|965557}} 934380
{{totient|965559}} 551736
{{totient|965561}} 902880
{{totient|965563}} 923560
{{totient|965567}} 965566
{{totient|965569}} 862800
{{totient|965571}} 634752
{{totient|965573}} 822960
{{totient|965577}} 641232
{{totient|965579}} 960384
{{totient|1015941}} 667872
{{totient|997 * 1019}} 1013928
{{totient|1015943}} 1013928
{{totient|1015945}} 696624
{{totient|1015947}} 672048
{{totient|1015949}} 874800
{{totient|1015950}} 249600

Examples with invalid input (argument validation by {{totient}} is omitted to spare some precious limited nesting levels of templates and/or parser functions).

Code Result
{{totient|0}} Expression error: Unrecognized word "strong".
{{totient|1031^2}} Expression error: Unrecognized word "strong".

Code

<noinclude><!-- {{documentation}} --><!-- We can't use it here, we reached the nesting levels limit of templates and/or parser functions! 

So we just borrow the necessary code from it instead.

--><div style="text-align: center; font-size: smaller;">The following [[Help:Documenting templates|documentation]] is located at [[Template:{{PAGENAME}}/doc]].</div>{{Template:{{PAGENAME}}/doc}}<!--

--></noinclude><includeonly>{{#expr: ( abs ({{{1|1}}}) ) * (1 - 0{{mpf| {{{1|1}}} |sep = ) * (1 - |key/val_sep = ^(-1) * 1^}} ) }}</includeonly>

See also







External links