This site is supported by donations to The OEIS Foundation.

Template:Number of distinct prime factors/doc

The {{number of distinct prime factors}} arithmetic function template returns omega(n), number of distinct primes dividing n ({{little omega(n)}}) of a nonzero integer, otherwise returns an error message.

Usage

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

or

{{little omega|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/A001221/b001221.txt Table of n, omega(n) for n = 1..100000)

Unfortunately, with the transclusion of {{Number of distinct prime factors/doc}} via the {{documentation}} template the precious limited nesting levels of templates and/or parser functions were exhausted! :-( Check {{Number of distinct prime factors/doc}} directly to see that all the tests are successful. Fortunately, by transcluding {{Number 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
{{number of distinct prime factors|210^2}} 4
{{little omega|210^2}} 4
{{little omega|-28}} 2
{{little omega|-5}} 1
{{little omega|1}} 0
{{little omega|7}} 1
{{little omega|15}} 2
{{little omega|27}} 1
{{little omega|30}} 3
{{little omega|111}} 2
{{little omega|5^3 * 11^2}} 2
{{little omega|2^5 * 3^3 * 5}} 3
{{little omega|2^9 * 3^3}} 2
{{little omega|37^2 + 8 * 37^2}} 2
{{little omega|2^9 * (26 + 1)}} 2
{{little omega|89 * 113}} 2
{{little omega|79 * 79}} 1
{{little omega|210^2}} 4
{{little omega|233^2}} 1
{{little omega|10000}} 2
{{little omega|65535}} 4
{{little omega|65536}} 1
{{little omega|65537}} 1
{{little omega|65539}} 1
{{little omega|65540}} 4
{{little omega|65541}} 3
{{little omega|65542}} 2
{{little omega|65543}} 1
{{little omega|65547}} 2
{{little omega|65549}} 3
{{little omega|65551}} 1
{{little omega|65553}} 2
{{little omega|65557}} 1
{{little omega|65559}} 3
{{little omega|65561}} 2
{{little omega|65563}} 1
{{little omega|65567}} 2
{{little omega|65569}} 4
{{little omega|65571}} 3
{{little omega|65573}} 2
{{little omega|65577}} 2
{{little omega|65579}} 1
{{little omega|265535}} 3
{{little omega|265536}} 3
{{little omega|265537}} 2
{{little omega|265539}} 2
{{little omega|265540}} 5
{{little omega|265541}} 1
{{little omega|265542}} 3
{{little omega|265543}} 1
{{little omega|265547}} 1
{{little omega|265549}} 2
{{little omega|265551}} 4
{{little omega|265553}} 2
{{little omega|265557}} 4
{{little omega|265559}} 3
{{little omega|265561}} 1
{{little omega|265563}} 3
{{little omega|265567}} 1
{{little omega|265569}} 2
{{little omega|265571}} 1
{{little omega|265573}} 3
{{little omega|265577}} 3
{{little omega|265579}} 1
{{little omega|257}} 1
{{little omega|97 * 211}} 2
{{little omega|216 * 211}} 3
{{little omega|1024 * 45}} 3
{{little omega|97 * 257}} 2
{{little omega|3^6 * 5^2}} 2
{{little omega|3 * 5^5}} 2
{{little omega|17^2 * 191}} 2
{{little omega|5 * 7 * 13 * 29}} 4
{{little omega|509^2}} 1
{{little omega|965535}} 4
{{little omega|965536}} 4
{{little omega|965537}} 2
{{little omega|965539}} 2
{{little omega|965540}} 4
{{little omega|965541}} 2
{{little omega|965542}} 3
{{little omega|965543}} 2
{{little omega|965547}} 3
{{little omega|965549}} 3
{{little omega|965551}} 1
{{little omega|965553}} 2
{{little omega|965557}} 2
{{little omega|965559}} 3
{{little omega|965561}} 3
{{little omega|965563}} 2
{{little omega|965567}} 1
{{little omega|965569}} 3
{{little omega|965571}} 3
{{little omega|965573}} 3
{{little omega|965577}} 3
{{little omega|965579}} 2
{{little omega|997 * 1019}} 2
{{little omega|1015943}} 2

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

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

```