Update
This commit is contained in:
parent
ba42573522
commit
62ed2dfb7e
9 changed files with 22 additions and 14 deletions
4
prime.md
4
prime.md
|
@ -1,6 +1,6 @@
|
|||
# Prime Number
|
||||
|
||||
Prime number (or just *prime*) is a [whole](integer.md) positive [number](number.md) only divisible by 1 and itself, except for the number [1](one.md). I.e. prime numbers are 2, 3, 5, 7, 11, 13, 17 etc. Prime numbers are extremely important, [interesting](interesting.md) and mysterious for their properties and distribution among other numbers, they have for millennia fascinated [mathematicians](math.md), nowadays they are studied in the math subfield called [number theory](number_theory.md). Primes are for example essential in [assymetric cryptography](assymetric_cryptography.md). Primes can be seen as the opposite of [highly composite numbers](highly_composite_number.md) (also antiprimes, numbers that have more divisors than any lower number).
|
||||
Prime number (or just *prime*) is a [whole](integer.md) positive [number](number.md) only divisible by 1 and itself, except for the number [1](one.md). I.e. prime numbers are 2, 3, 5, 7, 11, 13, 17 etc. Non-prime numbers are called *composite numbers*. Prime numbers are extremely important, [interesting](interesting.md) and mysterious for their properties and distribution among other numbers, they have for millennia fascinated [mathematicians](math.md), nowadays they are studied in the math subfield called [number theory](number_theory.md). Primes are for example essential in [assymetric cryptography](assymetric_cryptography.md). Primes can be seen as the opposite of [highly composite numbers](highly_composite_number.md) (also antiprimes, numbers that have more divisors than any lower number).
|
||||
|
||||
```
|
||||
.##.#.#...#.#...#.#...#.....#.#.....#...#.#...#.....#.....#.#.....#...
|
||||
|
@ -82,6 +82,8 @@ There also exists a term **pseudoprime** -- it stands for a number which is not
|
|||
433: 1, 439: 1, 443: 1, 449: 1, 457: 1, 461: 2, 463: 1, 467: 1, 479: 1, 487: 1, 491: 1, 499: 1, 503: 1, 509: 2, 521: 1, 523: 1, 541: 1, 547: 2, 557: 1, 563: 2, 569: 1, 571: 1, 577: 1, 587: 2, 593: 1, 599: 3, 601: 1, 607: 1, 613: 1, 617: 2, 619: 1, 631: 1, 641: 1, 643: 1, 647: 1, 653: 1, 659: 1, 661: 1, 673: 1, 677: 1, 683: 1, 691: 1, 701: 1, 709: 7, 719: 1, 727: 1, 733: 1, 739:
|
||||
2, 743: 1, 751: 1, 757: 1, 761: 1, 769: 1, 773: 2, 787: 1, 797: 2, 809: 1, 811: 1, 821: 1, 823: 1, 827: 1, 829: 1, 839: 1, 853: 1, 857: 1, 859: 2, 863: 1, 877: 2, 881: 1, 883: 1, 887: 1, 907: 1, 911: 1, 919: 3, 929: 1, 937: 1, 941: 1, 947: 1, 953: 1, 967: 2, 971: 1, 977: 1, 983: 1, 991: 2, 997: 1.
|
||||
|
||||
**Prime gaps**: statistically gaps between consecutive primes increase. The size of the gaps themselves make another number sequence that starts like this 1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14, 4, 6, 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 10, 6, 6, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 6, 4, 6, 8, 4, 8, 10.
|
||||
|
||||
## Algorithms
|
||||
|
||||
**Primality test**: testing whether a number is a prime is quite easy and not computationally difficult (unlike factoring the number). A [naive](naive.md) algorithm is called *trial division* and it tests whether any number from 2 up to the tested number divides the tested number (if so, then the number is not a prime, otherwise it is). This can be optimized by only testing numbers up to the [square root](sqrt.md) (including) of the tested number (if there is a factor greater than the square root, there is also another smaller than it which would already have been tested). A further simple optimization is to to test division by 2, 3 and then only numbers of the form 6q +- 1 (other forms are divisible by either 2 or 3, e.g 6q + 4 is always divisible by 2). Further optimizations exist and for maximum speed a [look up table](lut.md) may be used for smaller primes. A simple [C](c.md) function for primality test may look e.g. like this:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue