Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
least_divisor_function [2014/02/22 02:24] nikolaj |
least_divisor_function [2015/04/25 19:25] nikolaj |
||
---|---|---|---|
Line 2: | Line 2: | ||
==== Function ==== | ==== Function ==== | ||
- | | @#FFBB00: $ \mathrm{ld}:\mathbb N^+\to\{1\}\cup\mathrm{Prime\ number} $ | | + | | @#FFBB00: definiendum | @#FFBB00: $ \mathrm{ld}:\mathbb N^+\to\{1\}\cup\mathrm{Prime\ number} $ | |
- | | @#FFBB00: $ \mathrm{ld}(n):=\mathrm{min}\left(\mathrm{divisors}(n)\right) $ | | + | | @#FFBB00: definiendum | @#FFBB00: $ \mathrm{ld}(n):=\mathrm{min}\left(\mathrm{divisors}(n)\right) $ | |
- | ==== Discussion ==== | + | ----- |
=== Code === | === Code === | ||
+ | == Haskell == | ||
+ | <code haskell> | ||
+ | divides :: Integral a => a -> a -> Bool | ||
+ | divides d n = rem n d == 0 | ||
+ | </code> | ||
+ | |||
<code haskell> | <code haskell> | ||
ld :: Integral a => a -> a | ld :: Integral a => a -> a | ||
Line 15: | Line 21: | ||
| k^2 > n = n | | k^2 > n = n | ||
| otherwise = ldf (k+1) n | | otherwise = ldf (k+1) n | ||
+ | </code> | ||
+ | |||
+ | [[Set of divisors function]]: | ||
+ | <code haskell> | ||
+ | divides :: Integral a => a -> a -> Bool | ||
+ | divides d n = rem n d == 0 | ||
</code> | </code> | ||
=== Theorems === | === Theorems === | ||
If $n$ isn't a prime, then $n$ divided by the //least// divisor is some number bigger than $\mathrm{ld}(n)$ and hence | If $n$ isn't a prime, then $n$ divided by the //least// divisor is some number bigger than $\mathrm{ld}(n)$ and hence | ||
^ $\mathrm{ld}(n)^2\le n$ ^ | ^ $\mathrm{ld}(n)^2\le n$ ^ | ||
- | ==== Parents ==== | + | |
+ | ----- | ||
=== Subset of === | === Subset of === | ||
[[Surjective function]] | [[Surjective function]] |