This site is supported by donations to The OEIS Foundation.

Template:Product of distinct prime factors

From OeisWiki
(Redirected from Template:Rad)
Jump to: navigation, search

The {{product of distinct prime factors}} arithmetic function template returns the product of distinct prime factors of n (squarefree kernel of n) (radical of n, rad(n)) of a nonzero integer, otherwise returns an error message.

Usage

{{product of distinct prime factors|a nonzero integer}}

or

{{squarefree kernel|a nonzero integer}}

or

{{radical|a nonzero integer}}

or

{{rad|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/A007947/b007947.txt Table of n, rad(n) for n = 1..100000)

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

Code Result Comment
{{product of distinct prime factors|210^2}} 210
{{squarefree kernel|210^2}} 210
{{radical|210^2}} 210
{{rad|210^2}} 210
{{rad|-28}} 14
{{rad|-5}} 5
{{rad|-1}} 1 (empty product, i.e 1)
{{rad|1}} 1 (empty product, i.e 1)
{{rad|7}} 7
{{rad|15}} 15
{{rad|27}} 3
{{rad|30}} 30
{{rad|111}} 111
{{rad|5^3 * 11^2}} 55
{{rad|2^5 * 3^3 * 5}} 30
{{rad|2^9 * 3^3}} 6
{{rad|37^2 + 8 * 37^2}} 111
{{rad|2^9 * (26 + 1)}} 6
{{rad|89 * 113}} 10057
{{rad|79 * 79}} 79
{{rad|210^2}} 210
{{rad|233^2}} 233
{{rad|10000}} 10
{{rad|65535}} 65535
{{rad|65536}} 2
{{rad|65537}} 65537
{{rad|65539}} 65539
{{rad|65540}} 32770
{{rad|65541}} 65541
{{rad|65542}} 65542
{{rad|65543}} 65543
{{rad|65547}} 21849
{{rad|65549}} 65549
{{rad|65551}} 65551
{{rad|65553}} 65553
{{rad|65557}} 65557
{{rad|65559}} 1599
{{rad|65561}} 65561
{{rad|65563}} 65563
{{rad|65567}} 65567
{{rad|65569}} 65569
{{rad|65571}} 65571
{{rad|65573}} 65573
{{rad|65577}} 65577
{{rad|65579}} 65579
{{rad|265535}} 265535
{{rad|265536}} 2766
{{rad|265537}} 265537
{{rad|265539}} 265539
{{rad|265540}} 132770
{{rad|265541}} 265541
{{rad|265542}} 265542
{{rad|265543}} 265543
{{rad|265547}} 265547
{{rad|265549}} 265549
{{rad|265551}} 265551
{{rad|265553}} 265553
{{rad|265557}} 265557
{{rad|265559}} 265559
{{rad|265561}} 265561
{{rad|265563}} 88521
{{rad|265567}} 265567
{{rad|265569}} 265569
{{rad|265571}} 265571
{{rad|265573}} 265573
{{rad|265577}} 265577
{{rad|265579}} 265579
{{rad|257}} 257
{{rad|97 * 211}} 20467
{{rad|216 * 211}} 1266
{{rad|1024 * 45}} 30
{{rad|97 * 257}} 24929
{{rad|3^6 * 5^2}} 15
{{rad|3 * 5^5}} 15
{{rad|17^2 * 191}} 3247
{{rad|5 * 7 * 13 * 29}} 13195
{{rad|509^2}} 509
{{rad|965535}} 965535
{{rad|965536}} 60346
{{rad|965537}} 965537
{{rad|965539}} 965539
{{rad|965540}} 482770
{{rad|965541}} 965541
{{rad|965542}} 965542
{{rad|965543}} 965543
{{rad|965547}} 107283
{{rad|965549}} 56797
{{rad|965551}} 965551
{{rad|965553}} 965553
{{rad|965557}} 965557
{{rad|965559}} 965559
{{rad|965561}} 965561
{{rad|965563}} 965563
{{rad|965567}} 965567
{{rad|965569}} 965569
{{rad|965571}} 965571
{{rad|965573}} 965573
{{rad|965577}} 965577
{{rad|965579}} 965579
{{rad|1015941}} 1015941
{{rad|997 * 1019}} 1015943
{{rad|1015943}} 1015943
{{rad|1015945}} 1015945
{{rad|1015947}} 338649
{{rad|1015949}} 1015949
{{rad|1015950}} 203190

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

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

Code


<noinclude><!-- {{documentation}} --><!-- We can't use it here, the precious limited nesting levels of templates and/or parser functions get exhausted! 

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: 0{{mpf| {{{1|1}}} |sep = * |key/val_sep = * 1^}} + {{#ifexpr: abs ({{{1|1}}}) = 1 | 1 | 0 }} }}</includeonly>

See also







External links