Exploring Alternative Prime Sequences

  • Thread starter -Job-
  • Start date
  • Tags
    Primes
In summary: You are correct that the problem of prime factorization is polynomial time. However, the algorithm is still polynomial because numbers are represented in binary.
  • #1
-Job-
Science Advisor
1,158
4
Other "primes"

If, instead a defining a prime as an integer divisable only by 1 or itself, we define it as an integer not divisable by a number other than 1, 2, half of itself, or itself, (numbers not being divisable by 2 still "able" to be primes) then we generate a new "prime" sequence:
1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 14, 17, 19, 22, 23, 26, 27 ... etc
This way we allow even numbers to be "prime". We could also define a prime as a number not divisable by any number other than 1, 2, 3, third of self, half of self, self. As we do so we are clearly increasing the number of "primes". The question then is, are any of these sequences any easier to predict than the traditional primes?
If we let [tex]primes_{1}[/tex] be the traditional primes, then:
[tex]primes_{1} = 1, 3, 5, 7, 11, 13, 17, 19, 23, 27 ...[/tex]
[tex]primes_{2} = 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 14, 17, 19, 22, 23, 26, 27 ...[/tex]
[tex]primes_{3} = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19, 21, 22, 23, 26, 27 ...[/tex]
[tex]primes_{4} = ...[/tex]
Do you think these sequences behave similarly after a while? If they're all as "unpredictable", then that means that there are at least an infinity of sequences that are as unpredictable as the primes.
 
Last edited:
Physics news on Phys.org
  • #2
If, instead a defining a prime as an integer divisable only by 1 or itself
Technically, that's irreducible. For p to be prime, it has to satisfy:

Whenever p | ab, we have p | a or p | b.

(or both, of course)


The traditional primes, of course, include 2 and do not include 1. :tongue2:


Your set "primes2" is simply all numbers of the form:
2^m, p, 2p
where m < 4, and p is a prime.

Your set "primes3" is simply all numbers of the form:
2^m 3^n, p, 2p, 3p
where m+n < 4, and p is a prime.

Yes, you missed "18" in your list "primes3".


that means that there are at least an infinity of sequences that are as unpredictable as the primes.
We already knew that. Heck, as far as sequences go, the sequence of primes is extraordinarily simple. We can:
(1) Write down a list of properties that completely characterizes the primes.
(2) Write down an algorithm that, for any n, computes the n-th prime.
(3) Write down a formula for the n-th prime.

In some technical sense, (1) is extraordinarily rare, and I think (2) and (3) are even more rare.
 
  • #3
From an algorithm perspective identifying primes, or the nth prime isn't that simple, since Compositeness is in NP. We can't determine whether a number is composite or prime in polynomial time (that we/i know). To have an answer with 100% certainty you would need exponential time. I was wondering if adding numbers to the list of primes such as primes(2), and primes(3), or any other resulting from adding numbers to the primes, would produce a sequence whose elements we can identify in deterministic polynomial time, and at what point that change occurs. Such a sequence would say something about the certainty we can achieve in polynomial time, of whether a number is or isn't a prime. There are other problems in NP that seem to suffer the same problem of not being able to produce 100% certainty in polynomial time and which i have reduced to a sequence of numbers, similar but not equal to the primes.
 
  • #4
umm is Prime Factoring really in NP? i was under the impression
for (int i=0;i<=n/2;i++) isfactor(n,i) is an polynomial time problem? The problem is that it is computational inefficient to do this for very large n.
but the algorithm is still polynomial isn't it?
 
  • #5
No, you're not seeing it correctly. Numbers are represented in binary. So your n is represented in log(n) bits, hence the input size is actually log(n). Letting m be the input size, then you actually require (2^m)/2 operations.
I did see an article about an algorithm for identifying primes in polynomial time, but either it is not correct, or not yet accepted. In theory it could be, because Compositeness isn't NP complete, so it wouldn't say anything about whether P=NP, but i don't know that it is, and it is certainly not trivial to come up with such an algorithm.
 
Last edited:
  • #6
Actually, it is in P after all:
http://en.wikipedia.org/wiki/AKS_primality_test
Kind of unexpected for me, because in dealing with NP-complete problems i'd swear i was dealing with something very close to the primes. This means that a route to show that P=NP (unlikely) would be to reduce an NP-complete problem to the problem of "Primality testing".

It seems like I'm always wrong no matter what though. :P One of these days i'll run out of wrong things to say. :P
 
Last edited:
  • #7
neurocomp2003 said:
umm is Prime Factoring really in NP? i was under the impression
for (int i=0;i<=n/2;i++) isfactor(n,i) is an polynomial time problem? The problem is that it is computational inefficient to do this for very large n.
but the algorithm is still polynomial isn't it?
Does 'isfactor' take polynomial time?
 
  • #8
I'm guessing isFactor(n, i) would be equivalent to:
n mod i == 0
which is linear or quadratic, I'm not sure which, depends on how multiplication/division is implemented on the given architecture, but i think it's linear, it's definitely polynomial though. The problem is that looping from 0 to n/2 actually takes exponential time.
Neurocomp's algorithm isn't polynomial, but whether he knew it or not he is correct about Primality being in P. :tongue2:
 
Last edited:
  • #9
Well, primality testing and prime factoring are two different tasks. His algorithm for primality testing looks like it would take polynomial time to me. You're saying that isfactor is linear, and it is run n/2 times, so we'll get something on the order of n²/2 as the running time, wouldn't we? I don't understand this:

No, you're not seeing it correctly. Numbers are represented in binary. So your n is represented in log(n) bits, hence the input size is actually log(n). Letting m be the input size, then you actually require (2^m)/2 operations.
 
  • #10
Neurocomp's algorithm is the following:
function isPrime(n){
for(i=0; i<n/2; i++){
if(n % i == 0){
// n is composite
return false;
}
}
return true;
}

This function seems polynomial but isn't. The fact is that an algorithm's runtime is always defined with respect to the input size. The number n is the input, and the input size is the number of bits used to represent n. The number n is represented in binary, so, when we call isPrime(5) we are actually calling isPrime(101) since 5 is 101 in binary. The input size is 3.
If we call isPrime(512) the input size is 9.
The performance analysis is always done with respect to the input size. If we let m be the input size, then, the loop actually goes from 0 to ~(2^m)/2 which is exponential.
This is an important distinction because it says that the Primality problem isn't obviously solvable in deterministic polynomial time and hence isn't immediately in P. Only until recently, i didn't even know, did we find an algorithm that is deterministic and polynomial:
http://en.wikipedia.org/wiki/AKS_primality_test
But from what I've read it was always suspected that Primality was in P.

If we choose to see n as the input size, rather than log(n), then, by that standard, the AKS primality test would solve the Primality problem in O(log(n)^6) rather than Neurocomp's O(n), much faster.
It may seem like only a formality, and it kind of is, but unless we define all problems in the same manner, then it's of no use to group them in categories such as P and NP.
I mean that it's not incorrect to say that Neurocomp's algorithm is polynomial with respect to n, because it is, only that it's not in sync with how problems are generally analized, so it's a misleading statement.
 
Last edited:
  • #11
primality testing is in P, just look at the sieve of eratosthenes. super easy.
 
  • #12
ComputerGeek said:
primality testing is in P, just look at the sieve of eratosthenes. super easy.
How do you figure?

For testing a k-bit number, you have to sieve over an array of size [itex]2^k[/itex]. How do you plan on doing that in polynomial time?



Job: it's interesting to note that factoring is known to be a L(1/3, 1+e) algorithm (number field sieve) -- isn't that better than the best we know for NP problems? More food for thought.
 
Last edited:
  • #13
Hurkyl said:
How do you figure?

For testing a k-bit number, you have to sieve over an array of size [itex]2^k[/itex]. How do you plan on doing that in polynomial time?

Hmm...

Your right, I guess I should let my Number Theory prof know he was wrong :-) ( I like it when Profs are wrong, it reminds me that they are not infalable... no matter how some of them like to pretend they are)

I did a search after I read your post and found the Dynamic Wheel Sieve which is O(log log n).
 
  • #14
my bad..."prime factoring" i meant primality testing...reasons why ineed to sleep more
 
  • #15
ComputerGeek said:
Your right, I guess I should let my Number Theory prof know he was wrong :-) ( I like it when Profs are wrong, it reminds me that they are not infalable... no matter how some of them like to pretend they are)

or you misunderstood him.

ComputerGeek said:
I did a search after I read your post and found the Dynamic Wheel Sieve which is O(log log n).

What exactly are you claiming can be done in O(log log n) time? Certainly NOT test the primality of an integer n, this would give primality testing in the logarithmic time in the number of bits of n, much better than polynomial time.

Pritchard's wheel sieve gave something like O(N/log log N) time (measured in additions) to give a list of primes less than N. The may certainly have been improved upon (not to O(log log N) of course, or anything close). What sieve are you referring to?

edit- I googled "Dynamic Wheel Sieve" and one of the first links mentions pritchards with a running time of "O(n= log log n)", which may be what ComputerGeek found, a typo or ascii translation error.
 
Last edited:
  • #16
It's important to get our variables straight. If sieve(N) is a sieve that builds a list of all primes up to N, then let's define n such that n = log(N). So N is the input number, and n is the number of bits needed to represent N.
The runtime of the sieve of Erastothenes is O(N log log N) which is equivalent to O(2^n log n).
From what i saw online Pritchard's dynamic wheel sieve requires only O(N/log log N) which is equivalent to O(2^n/log n).

AKS primality test, on the other hand, performs in O((log N)^12) which is equivalent to O(n^12). Apparently it can very likely be reduced to O(n^6).
Of all algorithms only AKS is polynomial, but AKS isn't a sieve. It is used in determining whether a number is prime or not.
 
Last edited:
  • #17
shmoe said:
or you misunderstood him.
nope.


What exactly are you claiming can be done in O(log log n) time? Certainly NOT test the primality of an integer n, this would give primality testing in the logarithmic time in the number of bits of n, much better than polynomial time.

Pritchard's wheel sieve gave something like O(N/log log N) time (measured in additions) to give a list of primes less than N. The may certainly have been improved upon (not to O(log log N) of course, or anything close). What sieve are you referring to?

edit- I googled "Dynamic Wheel Sieve" and one of the first links mentions pritchards with a running time of "O(n= log log n)", which may be what ComputerGeek found, a typo or ascii translation error.

your right, I did use that first link. If it is a typo, then that is what it is.
 
  • #18
ComputerGeek said:
nope.

Do keep in mind the difference in polynomial time in n and polynomial time in the # of bits of n. It would be a true shame if your prof. claimed eratosthenes was polynomial in the number of bits of n.

ComputerGeek said:
your right, I did use that first link. If it is a typo, then that is what it is.

The = sign should be a division sign. The prime number theorem gives pi(x)~x/log(x) primes less than x, you can't possibly list them all in less time.
 

1. What are "other primes"?

"Other primes" refer to prime numbers that are not commonly studied or known, such as Mersenne primes, Sophie Germain primes, or factorial primes. These are special types of prime numbers that have unique properties and patterns.

2. Why is it important to explore other primes?

Exploring other primes can lead to a better understanding of the properties and patterns of prime numbers. This can have practical applications in fields such as cryptography and number theory. Additionally, studying these primes can help us discover new mathematical concepts and theories.

3. How are other primes different from regular primes?

Other primes have different mathematical properties and patterns compared to regular primes. For example, Mersenne primes are of the form 2^n - 1 and have been linked to perfect numbers, while factorial primes are of the form n! + 1 and have been linked to Wilson's theorem.

4. How do scientists research and discover new other primes?

Scientists use various methods and techniques to research and discover new other primes. This includes using computer programs to calculate and test prime numbers, as well as using mathematical proofs and theories to identify potential other primes.

5. Are there any practical applications for studying other primes?

Yes, there are several practical applications for studying other primes. These include improving encryption methods for data security, developing algorithms for efficient data storage and retrieval, and enhancing our understanding of the distribution of prime numbers in different numerical sequences.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
14
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
1K
  • General Math
Replies
24
Views
2K
  • General Math
Replies
3
Views
551
  • Precalculus Mathematics Homework Help
Replies
16
Views
2K
  • General Math
Replies
7
Views
1K
  • Precalculus Mathematics Homework Help
Replies
11
Views
1K
Replies
3
Views
770
  • Precalculus Mathematics Homework Help
Replies
3
Views
798
Back
Top