Primes: Difference between revisions
(Created page with "<table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> <td valign...") |
|||
Line 142: | Line 142: | ||
== Möbius Function == | == Möbius Function == | ||
<p>The Möbius function (<apll>7πR</apll>) returns information about the square free properties of <apll>R</apll>. If <apll>R</apll> is [http://en.wikipedia.org/wiki/Square-free_integer square free], the function returns <apll>1</apll> if <apll>R</apll> has an even number of prime factors, and <apll>¯1</apll> if it has an odd number of prime factors. If the argument is not square free, the function returns <apll>0</apll>. | <p>The [http://en.wikipedia.org/wiki/M%C3%B6bius_function Möbius function] (<apll>7πR</apll>) returns information about the square free properties of <apll>R</apll>. If <apll>R</apll> is [http://en.wikipedia.org/wiki/Square-free_integer square free], the function returns <apll>1</apll> if <apll>R</apll> has an even number of prime factors, and <apll>¯1</apll> if it has an odd number of prime factors. If the argument is not square free, the function returns <apll>0</apll>. It is used in the [http://en.wikipedia.org/wiki/M%C3%B6bius_inversion_formula Möbius Inversion Formula] to invert general arithmetic functions.</p> | ||
</p> | |||
== Totient Function == | == Totient Function == |
Revision as of 08:54, 7 April 2011
|
||||
R is a scalar or one-element vector consisting of a positive integer to be factored. | ||||
Z is an integer vector whose values are the prime factors of R. |
For example,
π120
2 2 2 3 5
×/⎕←π⎕←¯1+2*62
4611686018427387903
3 715827883 2147483647
4611686018427387903
π¯1+2*61
2305843009213693951
⍴π1
0
|
||||||||||||||||||
L is an integer scalar whose meaning is as follows
|
||||||||||||||||||
R is a scalar consisting of a positive integer to which one of the above functions is applied. | ||||||||||||||||||
Z is an integer. |
Divisor Count Function
The divisor count function (0πR) returns the number of divisors of a number. It is the same as ×/1+∪⍦πR where πR returns the prime factors of R and ∪⍦ counts the number of occurrences of unique elements (in this case, the exponent vector of the unique primes). A divisor then consists of the product of zero or more of the unique primes which is why ×/1+ counts them.
Divisor Sum Function
The divisor sum function (1πR) returns the sum of the divisors of a number. It is the same as ×/(¯1+(∪f)*1+∪⍦f)÷¯1+∪f←πR1. This function is used to recognize deficient, perfect, and abundant numbers.
Primality Test
The primality test function (2πR) returns a 1 if R is a prime and 0 if not.
Next Prime Function
The next prime function (3πR) returns the prime that immediately follows R.
Previous Prime Function
The previous prime function (4πR) returns the prime that immediately precedes R.
Nth Prime Function
The Nth prime function (5πR) returns the Rth prime where 2 is the first prime.
Number Of Primes Function
The number of primes function (6πR) returns number of primes less than or equal to R.
Möbius Function
The Möbius function (7πR) returns information about the square free properties of R. If R is square free, the function returns 1 if R has an even number of prime factors, and ¯1 if it has an odd number of prime factors. If the argument is not square free, the function returns 0. It is used in the Möbius Inversion Formula to invert general arithmetic functions.
Totient Function
The totient function (8πR) (also called Euler's Totient Function) returns the number of positive integers less than or equal to R that are relatively prime to it (i.e., having no common positive factors other than 1).