Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Formula for primes
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Possible formula using a recurrence relation== Another prime generator is defined by the [[recurrence relation]] :<math> a_n = a_{n-1} + \gcd(n,a_{n-1}), \quad a_1 = 7, </math> where gcd(''x'', ''y'') denotes the [[greatest common divisor]] of ''x'' and ''y''. The sequence of differences ''a''<sub>''n''+1</sub> β ''a<sub>n</sub>'' starts with 1, 1, 1, 5, 3, 1, 1, 1, 1, 11, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 23, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 3, 1, 5, 3, ... {{OEIS|id=A132199}}. {{harvtxt|Rowland|2008}} proved that this sequence contains only ones and prime numbers. However, it does not contain all the prime numbers, since the terms gcd(''n'' + 1, ''a<sub>n</sub>'') are always [[parity (mathematics)|odd]] and so never equal to 2. The same paper conjectures that the sequence contains all odd primes: in fact, 587 is the smallest odd prime not appearing in the first 10,000 outcomes different from 1.<ref>{{Citation |last1=Rowland |first1=Eric S. |title=A Natural Prime-Generating Recurrence |journal=Journal of Integer Sequences |volume=11 |issue=2 |pages=08.2.8 |year=2008 |url=http://www.cs.uwaterloo.ca/journals/JIS/VOL11/Rowland/rowland21.html |arxiv=0710.3217 |bibcode=2008JIntS..11...28R}}.</ref> This recurrence is rather inefficient. In perspective, it is trivial to write an algorithm to generate all prime numbers (from the definition), and many [[Generating primes|more efficient algorithms]] are known. Thus, such recurrence relations are more a matter of curiosity than of practical use.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)