This site is supported by donations to The OEIS Foundation.
Template:Moebius mu/doc
Warning: All templates/parser functions nesting levels are used, so you can't nest it any further (e.g. you can't transclude the {{Moebius mu/doc}} subpage) without causing deeply nested templates to fail to render, giving wrong results. There is also the minor (though nagging) issue of minus sign before 0 when 0 is multiplied by a negative (-1)^(little omega).
The {{Moebius mu}} ({{mu}}) arithmetic function template returns the Moebius (or Mobius) function mu(n), of a nonzero integer, otherwise returns an error message.
Usage
- {{Moebius mu|a nonzero integer}}
or
- {{mu|a nonzero integer}}
Valid input
A nonzero integer with absolute value less than 1031 2 = 1062961 (validation is done by the {{mpf}} arithmetic function template).
Examples
Examples with valid input (check with https://oeis.org/A008683/b008683.txt Table of n, mu(n) for n = 1..100000)
Unfortunately, with the transclusion of {{Moebius mu/doc}} via the {{documentation}} template the precious limited nesting levels of templates and/or parser functions were exhausted! :-( Check {{Moebius mu/doc}} directly to see that all the tests are successful. Unfortunately, by transcluding {{Moebius mu/doc}} directly, borrowing the minimum code needed here from the {{documentation}} template, we still exhaust the limit! :-(
Because the current code is inefficient (it calls the {{mpf}} template twice, and to avoid this we need to use a core function template to which we pass the result of mpf to some argument, problem is we have no spare precious limited templates/parser functions nesting levels!)
Code Result {{Moebius mu|210^2}} 0 {{mu|210^2}} 0 {{mu|-28}} 0 {{mu|-5}} -1 {{mu|1}} 1 {{mu|7}} -1 {{mu|15}} 1 {{mu|27}} -0 {{mu|30}} -1 {{mu|111}} 1 {{mu|5^3 * 11^2}} 0 {{mu|2^5 * 3^3 * 5}} -0 {{mu|2^9 * 3^3}} 0 {{mu|37^2 + 8 * 37^2}} 0 {{mu|2^9 * (26 + 1)}} 0 {{mu|89 * 113}} 1 {{mu|79 * 79}} -0 {{mu|210^2}} 0 {{mu|233^2}} -0 {{mu|10000}} 0 {{mu|15535}} -1 {{mu|15536}} 0 {{mu|15537}} 1 {{mu|15539}} 1 {{mu|15540}} -0 {{mu|15541}} -1 {{mu|15542}} -1 {{mu|15543}} -0 {{mu|15547}} 1 {{mu|15549}} -1 {{mu|15551}} -1 {{mu|15553}} 1 {{mu|15557}} 1 {{mu|15559}} -1 {{mu|15561}} 0 {{mu|15563}} 1 {{mu|15567}} 1 {{mu|15569}} -1 {{mu|15571}} 1 {{mu|15573}} -1 {{mu|15577}} 1 {{mu|15579}} 0 {{mu|65535}} 1 {{mu|65536}} -0 {{mu|65537}} -1 {{mu|65539}} -1 {{mu|65540}} 0 {{mu|65541}} -1 {{mu|65542}} 1 {{mu|65543}} -1 {{mu|65547}} 0 {{mu|65549}} -1 {{mu|65551}} -1 {{mu|65553}} 1 {{mu|65557}} -1 {{mu|65559}} -0 {{mu|65561}} 1 {{mu|65563}} -1 {{mu|65567}} 1 {{mu|65569}} 1 {{mu|65571}} -1 {{mu|65573}} 1 {{mu|65577}} 1 {{mu|65579}} -1 {{mu|95561}} -1 {{mu|95563}} 1 {{mu|95567}} 1 {{mu|95569}} -1 {{mu|95571}} 0 {{mu|95573}} 1 {{mu|95577}} 1 {{mu|95579}} 1 {{mu|965561}} -1 {{mu|965563}} 1 {{mu|965567}} -1 {{mu|965569}} -1 {{mu|965571}} -1 {{mu|965573}} -1 {{mu|965577}} -1 {{mu|965579}} 1 {{mu|1015941}} -1 {{mu|997 * 1019}} 1 {{mu|1015943}} 1 {{mu|1015945}} -1 {{mu|1015947}} -0 {{mu|1015949}} -1 {{mu|1015950}} -0
Examples with invalid input (argument validation by {{Moebius mu}} is omitted to spare some precious limited nesting levels of templates and/or parser functions).
Code Result {{mu|0}} Expression error: Unrecognized word "strong". {{mu|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}}<!-- Inefficient: we call the mpf template twice. To avoid this, we have to use a core function template where we pass the result of the mpf template call as some argument, problem is we don't have any spare of those precious limited templates/parser functions nesting levels! --></noinclude><includeonly>{{#expr: <!-- quadratfrei -->( not ( ( abs ({{{1|1}}}) ) - ( 0{{mpf| {{{1|1}}} |sep = * |key/val_sep = * 1^}} + {{#ifexpr: abs ({{{1|1}}}) = 1 | 1 | 0 }} ) ) ) * <!-- (-1)^(little omega) -->(-1)^( 0{{mpf| {{{1|1}}} |sep = + |key/val_sep = ^0 * 1^}} ) }}</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/