Formula for Primes (And Music Tangent)
If you were searching for the formula to generate prime numbers, how would you go about it?
Also, are there prime frequencies (I.E. an infinite number of unique notes)? What do they harmonize with?
[Edited by - anothrguitarist on May 7, 2009 12:29:08 AM]
--------------------Enigmatic Coding
May I recommend that you take a class dedicated to or including number theory(or buy a book or download an e-book or whatever)? The stuff you've been posting almost all falls under the umbrella of number theory, and it's a big field with a lot of exciting puzzles (both open and solved problems) so I'm sure you could a lot more through something formal than just by getting snippets here and there (not to say that there aren't lots of people here who are excellent at it).
Me, I'm terrible at it.
Me, I'm terrible at it.
-~-The Cow of Darkness-~-
Quote: Original post by anothrguitarist
If you were searching for the formula to generate prime numbers, how would you go about it?
Google?
Quote: Also, are there prime frequencies (I.E. an infinite number of unique notes)?
I'm not sure what you mean by 'prime frequencies'. Certainly there are an infinite number of unique intervals. Since there are infinitely many prime numbers there are infinitely many ratios of co-prime numbers, which can represent unique interval ratios. If you're interested in this kind of thing I'd recommend looking at Erv Wilson's research. (obviously I'm talking just intonation here...)
my stupid half-thought formula for finding primes:
List every integer number in existence.
Start a loop which goes from one to the target number.
multiply that number by the loop index and cross the result off the list of integers.
Increment your target number and repeat the loop.
Continue until target number becomes infinity.
All ints which haven't been crossed off list are prime numbers.
List every integer number in existence.
Start a loop which goes from one to the target number.
multiply that number by the loop index and cross the result off the list of integers.
Increment your target number and repeat the loop.
Continue until target number becomes infinity.
All ints which haven't been crossed off list are prime numbers.
Eric Nevala
Indie Developer | Spellbound | Dev blog | Twitter | Unreal Engine 4
Quote: Original post by slayemin
my stupid half-thought formula for finding primes:
List every integer number in existence.
Start a loop which goes from one to the target number.
multiply that number by the loop index and cross the result off the list of integers.
Increment your target number and repeat the loop.
Continue until target number becomes infinity.
All ints which haven't been crossed off list are prime numbers.
Well, you can eliminate even numbers right away. And anything that is a multiple of a prime you have already found. So that right there saves a lot of time. All you can really do to find primes is just eliminate as many numbers that you can be sure are not prime, and then start testing whatever remains more rigorously.
You've just described the Sieve of Eratosthenes. It's an ancient and efficient algorithm for finding primes.
NextWar: The Quest for Earth available now for Windows Phone 7.
Quote: Original post by anothrguitarist
If you were searching for the formula to generate prime numbers, how would you go about it?
Also, are there prime frequencies (I.E. an infinite number of unique notes)? What do they harmonize with?
you have an impressive intuition for this stuff. i too recommend learning number theory.
for part a: nope, no closed form formula
for part b see: http://en.wikipedia.org/wiki/Riemann_hypothesis
Here's just a quick hack I wrote to print out all prime numbers between 0 and 1,000.
#include <iostream>using namespace std;void main(void){ const int MAX = 1000; bool arr[MAX]; for(int a=0;a<MAX;a++) arr[a] = true; for(int a=2;a<MAX;a++) for(int b=a;b<MAX;b++) if(b%a == 0 && a!=b) arr = false; for(int a=0;a<MAX;a++) if(arr[a]) cout << a << ", "; system("pause");}
Eric Nevala
Indie Developer | Spellbound | Dev blog | Twitter | Unreal Engine 4
Quote: Original post by Daerax
you have an impressive intuition for this stuff. i too recommend learning number theory.
That's probably the best compliment from non-blood that I've received in years. [smile]
I took your advice and picked up a number theory book from my school library last night. I'm a few classes away from being able to take fun math (still have to take differential equations and linear algebra before I can get into abstract algebra, topology, and number theory), but I'll get there someday. I've been craving math recently.
About that music blurb in the OP, it interests me because when I learned about musical modes and that there are only twelve notes used in western music, I was incredibly disappointed. I had always thought music was much more elaborate than it actually is. I used to think there were "infinite" possibilities.
Prime frequencies are interesting, though. The only problem is that I doubt the frequencies would harmonize with the major scale and its modes. The pitch (frequency) itself is actually kind of arbitrary. It's the interval between two notes that's actually interesting.
--------------------Enigmatic Coding
Quote: Original post by anothrguitarist
About that music blurb in the OP, it interests me because when I learned about musical modes and that there are only twelve notes used in western music, I was incredibly disappointed. I had always thought music was much more elaborate than it actually is. I used to think there were "infinite" possibilities.
There are of course many many different tunings than the Western 12TET--Indian classical music, for example, uses 22 or 23 microtones depending on who you ask. There's also a lot of interesting work going on as far as Western microtonalists are concerned.
There are a lot of tuning possibilities that haven't been explored yet. Of course, there is our inherent limitation (precision of our ears to hear extremely small intervals).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement