# Is FACTORIZATION or PRIMES known to be in LOGSPACE

Are the integer factorization and PRIMES known to be in LOGSPACE?

Recently, it has been shown by researchers that PRIMES is in P. But this does not say anything about LOGSPACE since it is not known if LOGSPACE = P.

• Factorization definitely isn't, if it were then RSA encryption would be easily broken because factorization would be in P. Commented Aug 1, 2014 at 16:40
• jmite: But we don't know whether $\mathrm{FACTORIZATION}$ is in $\mathrm{P}$ or not. Commented Aug 1, 2014 at 19:23
• Definitely isn't known, sorry, should have clarified. Commented Aug 1, 2014 at 21:15
• I guess the only cases that are currently being tackled by algorithms in P are such cases as close primes... Commented Aug 9, 2014 at 20:37

Factoring is not known to be even in $\mathsf{P}$.

Primality is not known to be in any class conjectured to be smaller than $\mathsf{P}$ (AFAIK).

• "Factoring is not known to be even in" BPP. $\;$
– user12859
Commented Aug 1, 2014 at 21:10
• @Ricky, yes, I wanted to use more famous classes used in the question (and before you say, yes, BPP should be more well-known. :) Commented Aug 1, 2014 at 21:13

If the number is unary, yes, both are logspace. Sum up the 1's to find the number. Use trial division.

If the number is in binary, then logspace is in terms of the length of binary input. It's unknown.

Note that some semi-prime's smallest factor is approximately the square root of the number, which has O(n) digits.

Also note that logspace is in P (there are only polynomial state configurations with logspace), so factorization in logspace would imply factorization in P.