This site is supported by donations to The OEIS Foundation.
Template:Sum of prime factors (with multiplicity)
The {{sum of prime factors (with multiplicity)}} arithmetic function template returns the sum of prime factors of n (with multiplicity) (sopf(n), integer log of n) of a nonzero integer, otherwise returns an error message.
Usage
- {{sum of prime factors (with multiplicity)|a nonzero integer}}
or
- {{sopf|a nonzero integer}}
or
- {{integer log|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/A001414/b001414.txt Table of n, integer log of n for n = 1..100000)
Unfortunately, with the transclusion of {{sum of prime factors (with multiplicity)/doc}} via the {{documentation}} template the precious limited nesting levels of templates and/or parser functions were exhausted! :-( Check {{sum of prime factors (with multiplicity)/doc}} directly to see that all the tests are successful. Fortunately, by transcluding {{sum of prime factors (with multiplicity)/doc}} directly, borrowing the minimum code needed here from the {{documentation}} template, we manage to not exhaust the limit! :-)
Code Result {{sum of prime factors (with multiplicity)|210^2}} 34 {{integer log|210^2}} 34 {{sopf|210^2}} 34 {{sopf|-28}} 11 {{sopf|-5}} 5 {{sopf|1}} 0 {{sopf|7}} 7 {{sopf|15}} 8 {{sopf|27}} 9 {{sopf|30}} 10 {{sopf|111}} 40 {{sopf|5^3 * 11^2}} 37 {{sopf|2^5 * 3^3 * 5}} 24 {{sopf|2^9 * 3^3}} 27 {{sopf|37^2 + 8 * 37^2}} 80 {{sopf|2^9 * (26 + 1)}} 27 {{sopf|89 * 113}} 202 {{sopf|79 * 79}} 158 {{sopf|210^2}} 34 {{sopf|233^2}} 466 {{sopf|10000}} 28 {{sopf|65535}} 282 {{sopf|65536}} 32 {{sopf|65537}} 65537 {{sopf|65539}} 65539 {{sopf|65540}} 151 {{sopf|65541}} 3131 {{sopf|65542}} 32773 {{sopf|65543}} 65543 {{sopf|65547}} 7289 {{sopf|65549}} 171 {{sopf|65551}} 65551 {{sopf|65553}} 21854 {{sopf|65557}} 65557 {{sopf|65559}} 98 {{sopf|65561}} 1290 {{sopf|65563}} 65563 {{sopf|65567}} 552 {{sopf|65569}} 72 {{sopf|65571}} 2001 {{sopf|65573}} 2874 {{sopf|65577}} 21862 {{sopf|65579}} 65579 {{sopf|265535}} 2337 {{sopf|265536}} 479 {{sopf|265537}} 2158 {{sopf|265539}} 88516 {{sopf|265540}} 108 {{sopf|265541}} 265541 {{sopf|265542}} 44262 {{sopf|265543}} 265543 {{sopf|265547}} 265547 {{sopf|265549}} 7214 {{sopf|265551}} 646 {{sopf|265553}} 9186 {{sopf|265557}} 188 {{sopf|265559}} 709 {{sopf|265561}} 265561 {{sopf|265563}} 1578 {{sopf|265567}} 265567 {{sopf|265569}} 88526 {{sopf|265571}} 265571 {{sopf|265573}} 3467 {{sopf|265577}} 703 {{sopf|265579}} 265579 {{sopf|257}} 257 {{sopf|97 * 211}} 308 {{sopf|216 * 211}} 226 {{sopf|1024 * 45}} 31 {{sopf|97 * 257}} 354 {{sopf|3^6 * 5^2}} 28 {{sopf|3 * 5^5}} 28 {{sopf|17^2 * 191}} 225 {{sopf|5 * 7 * 13 * 29}} 54 {{sopf|509^2}} 1018 {{sopf|965535}} 1158 {{sopf|965536}} 245 {{sopf|965537}} 14478 {{sopf|965539}} 11716 {{sopf|965540}} 2131 {{sopf|965541}} 321850 {{sopf|965542}} 25430 {{sopf|965543}} 2904 {{sopf|965547}} 3271 {{sopf|965549}} 304 {{sopf|965551}} 965551 {{sopf|965553}} 321854 {{sopf|965557}} 31178 {{sopf|965559}} 45989 {{sopf|965561}} 679 {{sopf|965563}} 42004 {{sopf|965567}} 965567 {{sopf|965569}} 1511 {{sopf|965571}} 4485 {{sopf|965573}} 787 {{sopf|965577}} 1247 {{sopf|965579}} 5196 {{sopf|1015941}} 4715 {{sopf|997 * 1019}} 2016 {{sopf|1015943}} 2016 {{sopf|1015945}} 29039 {{sopf|1015947}} 882 {{sopf|1015949}} 4891 {{sopf|1015950}} 549
Examples with invalid input (argument validation by {{sopf}} is omitted to spare some precious limited nesting levels of templates and/or parser functions).
Code Result {{sopf|0}} Expression error: Unrecognized word "strong". {{sopf|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 = * }} }}</includeonly>
See also
- {{distinct prime factors up to sqrt(n)}} or {{dpf le sqrt(n)}}
- {{distinct nontrivial prime factors}} or {{dpf lt n}}
- {{distinct prime factors}} or {{dpf}}
- {{number of distinct prime factors}} or {{little omega}}
- {{sum of distinct prime factors}} or {{sodpf}}
- {{product of distinct prime factors}} or {{squarefree kernel}} or {{radical}} or {{rad}}
- {{multiplicity}}
- {{prime factors (with multiplicity) up to sqrt(n)}} or {{mpf le sqrt(n)}}
- {{nontrivial prime factors (with multiplicity)}} or {{mpf lt n}}
- {{prime factors (with multiplicity)}} or {{mpf}} or {{factorization}}
- {{number of prime factors (with multiplicity)}} or {{big Omega}}
- {{sum of prime factors (with multiplicity)}} or {{sopfr}} or {{integer log}}
- {{product of prime factors (with multiplicity)}} (must give back {{abs|n}}, the absolute value of
)n
- {{quadratfrei}}
- {{Moebius mu}} or {{mu}}
- {{Euler phi}} or {{totient}}
- {{Dedekind psi}}
- {{number of divisors}} or {{sigma 0}} or {{tau}}
- {{sum of divisors}} or {{sigma 1}} or {{sigma}} (Cf. {{divisor function}} or {{sigma k}}, with
(default value))k = 1 - {{divisor function}} or {{sigma k}} (for
)k ≠ 0
External links
- Andrew Hodges, Java Applet for Factorization
- http://factordb.com/