Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
least_divisor_function [2014/03/21 11:11] 127.0.0.1 external edit |
least_divisor_function [2015/04/25 19:25] nikolaj |
||
---|---|---|---|
Line 5: | Line 5: | ||
| @#FFBB00: definiendum | @#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> | ||
+ | |||
+ | using [[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]] |