This site is supported by donations to The OEIS Foundation.

Template:Sum of distinct prime factors

From OeisWiki
Jump to: navigation, search

The {{sum of distinct prime factors}} arithmetic function template returns the sum of distinct prime factors of n (sodpf(n)) of a nonzero integer, otherwise returns an error message.

Usage

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

or

{{sodpf|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/A008472/b008472.txt Table of n, sodpf(n) for n = 1..100000)

Unfortunately, with the transclusion of {{sum of distinct prime factors/doc}} via the {{documentation}} template the precious limited nesting levels of templates and/or parser functions were exhausted! :-( Check {{sum of distinct prime factors/doc}} directly to see that all the tests are successful. Fortunately, by transcluding {{sum 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
{{sum of distinct prime factors|210^2}} 17
{{sodpf|210^2}} 17
{{sodpf|-28}} 9
{{sodpf|-5}} 5
{{sodpf|1}} 0
{{sodpf|7}} 7
{{sodpf|15}} 8
{{sodpf|27}} 3
{{sodpf|30}} 10
{{sodpf|111}} 40
{{sodpf|5^3 * 11^2}} 16
{{sodpf|2^5 * 3^3 * 5}} 10
{{sodpf|2^9 * 3^3}} 5
{{sodpf|37^2 + 8 * 37^2}} 40
{{sodpf|2^9 * (26 + 1)}} 5
{{sodpf|89 * 113}} 202
{{sodpf|79 * 79}} 79
{{sodpf|210^2}} 17
{{sodpf|233^2}} 233
{{sodpf|10000}} 7
{{sodpf|65535}} 282
{{sodpf|65536}} 2
{{sodpf|65537}} 65537
{{sodpf|65539}} 65539
{{sodpf|65540}} 149
{{sodpf|65541}} 3131
{{sodpf|65542}} 32773
{{sodpf|65543}} 65543
{{sodpf|65547}} 7286
{{sodpf|65549}} 171
{{sodpf|65551}} 65551
{{sodpf|65553}} 21854
{{sodpf|65557}} 65557
{{sodpf|65559}} 57
{{sodpf|65561}} 1290
{{sodpf|65563}} 65563
{{sodpf|65567}} 552
{{sodpf|65569}} 72
{{sodpf|65571}} 2001
{{sodpf|65573}} 2874
{{sodpf|65577}} 21862
{{sodpf|65579}} 65579
{{sodpf|265535}} 2337
{{sodpf|265536}} 466
{{sodpf|265537}} 2158
{{sodpf|265539}} 88516
{{sodpf|265540}} 106
{{sodpf|265541}} 265541
{{sodpf|265542}} 44262
{{sodpf|265543}} 265543
{{sodpf|265547}} 265547
{{sodpf|265549}} 7214
{{sodpf|265551}} 646
{{sodpf|265553}} 9186
{{sodpf|265557}} 188
{{sodpf|265559}} 709
{{sodpf|265561}} 265561
{{sodpf|265563}} 1575
{{sodpf|265567}} 265567
{{sodpf|265569}} 88526
{{sodpf|265571}} 265571
{{sodpf|265573}} 3467
{{sodpf|265577}} 703
{{sodpf|265579}} 265579
{{sodpf|257}} 257
{{sodpf|97 * 211}} 308
{{sodpf|216 * 211}} 216
{{sodpf|1024 * 45}} 10
{{sodpf|97 * 257}} 354
{{sodpf|3^6 * 5^2}} 8
{{sodpf|3 * 5^5}} 8
{{sodpf|17^2 * 191}} 208
{{sodpf|5 * 7 * 13 * 29}} 54
{{sodpf|509^2}} 509
{{sodpf|965535}} 1158
{{sodpf|965536}} 237
{{sodpf|965537}} 14478
{{sodpf|965539}} 11716
{{sodpf|965540}} 2129
{{sodpf|965541}} 321850
{{sodpf|965542}} 25430
{{sodpf|965543}} 2904
{{sodpf|965547}} 3265
{{sodpf|965549}} 287
{{sodpf|965551}} 965551
{{sodpf|965553}} 321854
{{sodpf|965557}} 31178
{{sodpf|965559}} 45989
{{sodpf|965561}} 679
{{sodpf|965563}} 42004
{{sodpf|965567}} 965567
{{sodpf|965569}} 1511
{{sodpf|965571}} 4485
{{sodpf|965573}} 787
{{sodpf|965577}} 1247
{{sodpf|965579}} 5196
{{sodpf|1015941}} 4715
{{sodpf|997 * 1019}} 2016
{{sodpf|1015943}} 2016
{{sodpf|1015945}} 29039
{{sodpf|1015947}} 879
{{sodpf|1015949}} 4891
{{sodpf|1015950}} 544

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

Code Result
{{sodpf|0}} Expression error: Unrecognized word "strong".
{{sodpf|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^}} }}</includeonly>

See also







External links