WrongPlanet.net
WP Members: > 70,000

Aspie Affection

New Today: 8
New Yesterday: 29

Method for generating prime numbers Previous  1, 2, 3, 4, 5, 6, 7, 8  
Post new topic   Reply to topic    Wrong Planet Autism Forum Index -> Computers, Math, Science, and Technology     
Shorttail
Blue Jay
Blue Jay


Joined: Feb 04, 2012
Age: 26
Posts: 94
Location: Aarhus, Denmark

PostPosted: Wed Feb 22, 2012 4:40 pm    Post subject: Reply with quote

I'd write it if someone can explain the nature of each function.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
heavenlyabyss
Phoenix
Phoenix


Joined: Sep 10, 2011
Posts: 530

PostPosted: Thu Feb 23, 2012 5:54 am    Post subject: Reply with quote

Shorttail wrote:
I'd write it if someone can explain the nature of each function.


I have posted the Diophantine equations from two different sources. The second source expresses the formulas in a more compact way and may be easier to program. I have not checked its accuracy, of course but I am assuming it legit.

http://mathworld.wolfram.com/PrimeDiophantineEquations.html

http://en.wikipedia.org/wiki/Formula_for_primes
Back to top
View user's profile Send private message
Shorttail
Blue Jay
Blue Jay


Joined: Feb 04, 2012
Age: 26
Posts: 94
Location: Aarhus, Denmark

PostPosted: Thu Feb 23, 2012 2:10 pm    Post subject: Reply with quote

I feel rather silly, I did not get what the different parts of the equation meant. It makes more sense now. Basically I have to do Gaussian elimination on the 14 equations and see if there are possible solutions?
I think there's a u^8 in in equation 11. x.x Not even going to bother.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
heavenlyabyss
Phoenix
Phoenix


Joined: Sep 10, 2011
Posts: 530

PostPosted: Fri Feb 24, 2012 5:34 am    Post subject: Reply with quote

Shorttail wrote:
I feel rather silly, I did not get what the different parts of the equation meant. It makes more sense now. Basically I have to do Gaussian elimination on the 14 equations and see if there are possible solutions?
I think there's a u^8 in in equation 11. x.x Not even going to bother.


Yes, it is a little complex. I'm sure you could program it but it wouldn't be the effort most likely unless you truly believe it will bring fruitful results. I am sure it has already been done by others.

As far as making the algorithm efficient I am not a good enough programmer to say how to do that. It was just an idea I was throwing out there. Smile
Back to top
View user's profile Send private message
Shorttail
Blue Jay
Blue Jay


Joined: Feb 04, 2012
Age: 26
Posts: 94
Location: Aarhus, Denmark

PostPosted: Fri Feb 24, 2012 8:58 am    Post subject: Reply with quote

heavenlyabyss wrote:
As far as making the algorithm efficient I am not a good enough programmer to say how to do that. It was just an idea I was throwing out there. Smile

I don't know if the equation gets more complex as k goes up. If it does there's little point trying to implement it when there are already working algorithms that solve it for a single input. I read that there's a set of equations with 52 variables and only x^4, but that's still out of scope for my math abilities. Now... if there was one with 208 variables and only x^1, that would be "easy". :3
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Philosopheratwork
Emu Egg
Emu Egg


Joined: Jan 15, 2011
Posts: 2

PostPosted: Tue Jan 22, 2013 3:51 pm    Post subject: Prime numbers Reply with quote

For prime numbers (p), under 3 squared; p = 2a + 1 (where a = any whole number)
For prime numbers (r), under 5 squared; r = 3p +/- 2 or 4
For prime numbers (i), under 7 squared; i = 5r +/- 6 or 12 or 18 or 24
For prime numbers (m), under 11 squared; m = 7i +/- 30 or 60 or 90 or 120 or 150 or 180
For prime numbers (e), under 13 squared; e = 11m +/- 210 or 420 or 630 or 840 or 1050 or 1260 or 1470 or 1680 or 1890 or 2100

(A no. divisible by a, but not divisible by a group b +/- A no. divisible by group b, but not a = A no. not divisible by a or b.)

* Some rules give 1 but this is not prime.
Back to top
View user's profile Send private message
Thom_Fuleri
Phoenix
Phoenix


Joined: Mar 08, 2010
Posts: 802
Location: Leicestershire, UK

PostPosted: Wed Jan 23, 2013 2:01 pm    Post subject: Re: Prime numbers Reply with quote

Philosopheratwork wrote:
For prime numbers (p), under 3 squared; p = 2a + 1 (where a = any whole number)


Prime numbers under 3 squared (or 9, as I know it) are 2, 3, 5 and 7. This "rule" is thus correct, but largely through coincidence - it returns odd numbers, not primes, which is why it breaks down after this arbitrary point.

It also doesn't cover 2.

Quote:
For prime numbers (r), under 5 squared; r = 3p +/- 2 or 4


Primes up to 25 are 2, 3, 5, 7, 11, 13, 17, 19, 23. This formula is even more useless than the first one, as we're looking at four possible values for each value of p (3p+2, 3p+4, 3p-2, 3p-4). And you need to work out the values of p first.

Quote:
For prime numbers (i), under 7 squared; i = 5r +/- 6 or 12 or 18 or 24
For prime numbers (m), under 11 squared; m = 7i +/- 30 or 60 or 90 or 120 or 150 or 180
For prime numbers (e), under 13 squared; e = 11m +/- 210 or 420 or 630 or 840 or 1050 or 1260 or 1470 or 1680 or 1890 or 2100


I'm not even going to bother checking these. That last line has 20 possible permutations for every value of m and only holds up to 169! How many permutations are there for numbers up to 17 squared (289)? 32 per value of e?

Quote:
(A no. divisible by a, but not divisible by a group b +/- A no. divisible by group b, but not a = A no. not divisible by a or b.)


I'm not sure what this is referring to. It doesn't seem to relate to the earlier formulae.

A more interesting observation is that every prime number aside from 2 and 3 (I agree that 1 is not prime) can be expressed as 6n+/-1. Not every value of 6n+1 or 6n-1 is prime, but every prime IS expressable this way. Proof:

Any number can be expressed as 6n+k, where k is in the range 0-5.
For k=0, this is trivial - the number is divisible by 6, so not prime.
For k=2 or 4, 6n+k is divisible by 2.
For k=3, 6n+k is divisible by 3.
So all primes must necessarily be either 6n+1 or 6n+5. We can express the second as 6n-1 (because 6n+5 is 6(n+1)-1, and n is an arbitrary value here).
Back to top
View user's profile Send private message
Comp_Geek_573
Phoenix
Phoenix


Joined: Sep 28, 2011
Age: 28
Posts: 546

PostPosted: Wed Jan 23, 2013 3:02 pm    Post subject: Reply with quote

I remember noticing in childhood that all prime numbers after 5 would have to end in 1, 3, 7 or 9, since those ending in 0, 2, 4, 6, 8 are all divisible by 2 and those ending in 5 are divisible by 5.

The above is basically saying that if written in base 6, they'd have to end in 1 or 5 after 3.
_________________
Your Aspie score: 98 of 200
Your neurotypical (non-autistic) score: 103 of 200
You seem to have both Aspie and neurotypical traits
AQ: 33
Back to top
View user's profile Send private message
Post new topic   Reply to topic    Wrong Planet Autism Forum Index -> Computers, Math, Science, and Technology   
Previous  1, 2, 3, 4, 5, 6, 7, 8  

 
Read more Articles on Wrong Planet



Wrong Planet is a Registered Trademark.
Copyright 2004-2013, Wrong Planet, LLC and Alex Plank. Alex does public speaking for Autism.

Advertise on Wrong Planet

Alex Hotchalk / Glam 

Alex Plank  Aspie Affection 

Terms of Service - You must read this as a user of Wrong Planet | Privacy Policy

Subscribe: RSS Feed  Wrong Planet News  Wrong Planet Forums




fine art