This site is supported by donations to The OEIS Foundation.

Template:Number of divisors

Jump to: navigation, search
The following documentation is located at Template:Number of divisors/doc.

The {{number of divisors}} arithmetic function template returns Tau(n), the number of divisors of n (${\displaystyle \scriptstyle \tau (n)\,}$) of a nonzero integer, otherwise returns an error message.

Usage

{{tau|a nonzero integer}}

or

{{number of divisors|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/A000005/b000005.txt Table of n, tau(n) for n = 1..100000)

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

Code Result
{{number of divisors|210^2}} 81
{{tau|210^2}} 81
{{tau|-28}} 6
{{tau|-5}} 2
{{tau|1}} 1
{{tau|7}} 2
{{tau|15}} 4
{{tau|27}} 4
{{tau|30}} 8
{{tau|111}} 4
{{tau|5^3 * 11^2}} 12
{{tau|2^5 * 3^3 * 5}} 48
{{tau|2^9 * 3^3}} 40
{{tau|37^2 + 8 * 37^2}} 9
{{tau|2^9 * (26 + 1)}} 40
{{tau|89 * 113}} 4
{{tau|79 * 79}} 3
{{tau|210^2}} 81
{{tau|233^2}} 3
{{tau|10000}} 25
{{tau|65535}} 16
{{tau|65536}} 17
{{tau|65537}} 2
{{tau|65539}} 2
{{tau|65540}} 24
{{tau|65541}} 8
{{tau|65542}} 4
{{tau|65543}} 2
{{tau|65547}} 6
{{tau|65549}} 8
{{tau|65551}} 2
{{tau|65553}} 4
{{tau|65557}} 2
{{tau|65559}} 12
{{tau|65561}} 4
{{tau|65563}} 2
{{tau|65567}} 4
{{tau|65569}} 16
{{tau|65571}} 8
{{tau|65573}} 4
{{tau|65577}} 4
{{tau|65579}} 2
{{tau|265535}} 8
{{tau|265536}} 42
{{tau|265537}} 4
{{tau|265539}} 4
{{tau|265540}} 48
{{tau|265541}} 2
{{tau|265542}} 8
{{tau|265543}} 2
{{tau|265547}} 2
{{tau|265549}} 4
{{tau|265551}} 16
{{tau|265553}} 4
{{tau|265557}} 16
{{tau|265559}} 8
{{tau|265561}} 2
{{tau|265563}} 12
{{tau|265567}} 2
{{tau|265569}} 4
{{tau|265571}} 2
{{tau|265573}} 8
{{tau|265577}} 8
{{tau|265579}} 2
{{tau|257}} 2
{{tau|97 * 211}} 4
{{tau|216 * 211}} 32
{{tau|1024 * 45}} 66
{{tau|97 * 257}} 4
{{tau|3^6 * 5^2}} 21
{{tau|3 * 5^5}} 12
{{tau|17^2 * 191}} 6
{{tau|5 * 7 * 13 * 29}} 16
{{tau|509^2}} 3
{{tau|965535}} 16
{{tau|965536}} 48
{{tau|965537}} 4
{{tau|965539}} 4
{{tau|965540}} 24
{{tau|965541}} 4
{{tau|965542}} 8
{{tau|965543}} 4
{{tau|965547}} 16
{{tau|965549}} 12
{{tau|965551}} 2
{{tau|965553}} 4
{{tau|965557}} 4
{{tau|965559}} 8
{{tau|965561}} 8
{{tau|965563}} 4
{{tau|965567}} 2
{{tau|965569}} 8
{{tau|965571}} 8
{{tau|965573}} 8
{{tau|965577}} 8
{{tau|965579}} 4
{{tau|1015941}} 8
{{tau|997 * 1019}} 4
{{tau|1015943}} 4
{{tau|1015945}} 8
{{tau|1015947}} 12
{{tau|1015949}} 8
{{tau|1015950}} 48

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

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

Code


<noinclude><!-- {{documentation}} --><!-- We can't use it here, we reached the nesting levels limit of templates and/or parser functions!

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