Could you define what you mean by "pattern in an integer value"? It's unclear to me if you're asking about specific bit-patterns, or simply about integer value characteristics…
–
e-sushi♦Feb 1 '14 at 19:42

@e-sushi: any pattern like bit pattern or integer value characteristics which indicate a given value is or not a product of two prime numbers.
–
User2014Feb 2 '14 at 7:03

5 Answers
5

No, there is no known test that we can run on a 2048 bit composite number that would indicate whether it was the product of two primes, or whether it was the product of more than two primes.

About the closest we can get is a zero knowledge proof; we know how someone (who does know the factorization) can run an interactive proof with us that can demonstrate to us that there are only two prime factors (and not reveal anything else). However, that does not appear what you're asking for.

you mean to say that no known test (apart from brute-force) for small or large integer values?
–
User2014Feb 2 '14 at 11:42

1

@User2014: there is no known test that is easier that factorization; for small (say, 128 bit) numbers, yes, we can determine whether the integer was a factor of two primes, but we can also factor that integer as well. Note that the 'answers' that Messer and Sebastian gave were really factorization methods.
–
ponchoFeb 2 '14 at 12:32

2

Can you add a bit of information about that ZKP?
–
CodesInChaos♦Feb 3 '14 at 8:39

I don't think there is a proof for exactly 2 distinct prime factors. You can proof that you know a nontrivial prime factor, or that you know the entire factorization. But I think you can not proof that there are exactly 2 of them.
–
tyloFeb 3 '14 at 15:20

It is not possible to ensure a number is power of two primes (without effectively factoring the number). NIST has defined tests which are used in context of validating RSA public key, which you could use.

The length of the modulus is one of the specified values in FIPS 186-3.

The value of the public exponent is in the valid range, as specified in FIPS 186-3.

The modulus and the public exponent are odd numbers.

The modulus is composite, but not a power of a prime

The modulus has no factors smaller than 752. Testing for additional factors is allowed.

The tests 1-2 are specific to NIST specifications for RSA, however, tests 3-5 are generally useful. In your case also test 1 applies: 2048-bit was the size the question was about. Apply the tests for modulus to your large 2048-bit number. After these tests, it is (probably) proven that the number:

has no small factors (test 5)

the number is not a prime or a power of prime (test 4)

Test 4 is usually implemented using tests from FIPS 186-3 (enhanced Miller-Rabin test).

Note: in case the test 5 fails, it is still possible that the number is indeed product of two primes. (I.e. one of factors is a small prime and another is a large prime.) Such numbers are valid for "product of two primes", but are not useful in some cryptographic algorithms such as RSA.

All these tests will not prove that the value is product of two primes. Instead, a product of more primes may still pass the tests. A prime number, however, will be very unlikely to pass above tests.

These tests are convenient to implement in the sense that if you have cryptographic module which is capable of generating key for RSA, many of the tests are likely already implemented by it.

BTW, in case this is about RSA, you could be able to use some other means of public key validity checking, including e.g. TTP Key Pair Validation.

@Ricky Demer: For testing factor up-to 752, it is possible to use GCD(n, 14518877557776399015115874320830702024226143809848893135505709196593151770659565‌​743590789126541491676439926842369913057775743308316665115891457010597107422766927‌​578829157562209019982129757565432235504904310130610821310408080105652937489269014‌​42915057819663730454818359472391642885328171302299245556663073719855) = 1, which is actually quite fast test to perform. But, beyond a predefined set of small primes, it is unsure if it is useful to continue further (unless you're actually trying to factorize).
–
user4982Feb 3 '14 at 18:59

This isn't exactly what the OP was asking. It sounds like the OP wants to know if a number is composite without having to find the factors.
–
Cole JohnsonFeb 8 '14 at 19:43

1

@ColeJohnson: actually the OP does not want to distinguish between prime numbers and composites (that one is easy); he wants to distinguish between composites which are the product of exactly two primes, and composites which are products of three primes or more (and for that one, we don't know of any method which is faster than actually factoring the integer, at least partially).
–
Thomas PorninFeb 8 '14 at 20:42

There are priminality tests that can be executed very efficiently. They come in different flavors (AKS->for sure, Rabin-Miller->with a 1-1/2^k probability etc). They will tell you if a big number is prime or not (answer true/false), so they will not tell you whether the number is divided by two or more primes.
If the question is only for two primes, then the answer is definitely not. There is no efficient algorithm (non-quantum) that can tell you by how many primes a given integer is divided.

@ColeJohnson: the "precomputed primorial" for a prime of that size is approximately $2^{1400}$ bits long. Yes, in addition to computing the gcd, just storing it would be highly nontrivial -- that is part of why I was skeptical of this approach...
–
ponchoJul 16 '14 at 3:39