# np or np complete proof of a factory problem

Good evening everyone;

I face with this problem and I could not find a way to proof it. Here is the problem;

A={Writing out the factorial of a number in unary NP-complete or NP-hard (e.g. n! = 11 for n= 2)}

The thing that I don't understand is this problem should be in A ∈P.I assume we can write a function on polynomial time to solve this problem? Should we assume that P=NP and give a function in a programming language that does this in order to proof?

Regards,

• How many digits do you expect for a number $n$? – miniBill Dec 27 '13 at 21:44
• n can be all positive integers. – Can Dec 27 '13 at 21:47
• Sorry, I meant: how many digits of output do you expect for a number $n$. – miniBill Dec 27 '13 at 21:49
• Dear minibill; There is no limitations about number of digits of an output. if n=5 5!=120 so I expect 111111...(120) ones. – Can Dec 27 '13 at 21:53
• It was an hint in the right direction :) Let me write an answer. – miniBill Dec 27 '13 at 21:54

There's some conceptual trouble from the outset, in that the P and (in particular) NP classes are usually only defined for decision problems -- that is, problems where there is only two possible answers to every instance of the problem. The task of outputting $n!$ symbols is not of this kind, and therefore it doesn't make much sense to ask whether it is in NP.

The usual way to apply the P/NP question to such a problem is to reformulate it as a family of decision problems -- for example,

Given $n$ and $k$, what is the $k$th bit of the binary representation of $n!$, counting from the ones end?

The complexity class can, however, also depend on the input representation. In the above reformulation, if $n$ and $k$ are given in unary notation, then the problem is easily seen to be in $P$. But if they are given in binary notation, then it's not obvious to me that it is even in $NP$.

To write the factorial in unary you'll need to output $n!$ ones, and this will take time at least $n!$, which is not $O(n^k)$ for any $k \in N$

• Dear minibill; Thanks for the answer. You are right it will take n!(!).I beg your pardon for my question but now this problem is NP complete,NP hard or NP? – Can Dec 27 '13 at 22:01
• I think it's NP but neither complete nor hard, but I don't know how to prove it – miniBill Dec 27 '13 at 22:02
• Thus, another question is lets say this is NP. Should we try to solve this problem in polynomial time? or there is certainly no way to solve this problem in polynomial time ? or there is way but we don't know yet ? – Can Dec 27 '13 at 22:10
• Wait a sec... this problem is not in NP! I just noticed it – miniBill Dec 27 '13 at 22:14
• That is really confusing. If you think P=NP yeah it is not but if you say P < NP how can I discriminate it is NP, NP completeness or NP-Hard ? – Can Dec 27 '13 at 22:21