CDRSANJ - CODER FIRST PROBLEM

<strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p>
<strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p><strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p><strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p><strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p><strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p><strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p>
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p><strong>CODER SANJAY</strong> is now ready to put up his first problem in his favorrite website <strong>SPOJ</strong>.As it is his first problem,he wanted it to be easy so that most of them could get an <strong>AC</strong>.
The problem statement looks like this:
<p>
<br><strong>F(x)</strong> is a function whose properties are as follows.</br>
<p>1.<strong>F(x)=0</strong> at x=0.</p>
<p>2.<strong>F(x)=1</strong> at x=1.</p>
<p>3.<strong>F(x)=2</strong> at x=2.</p>
<p>4.<strong>F(x)=0</strong> if x is odd prime.</p>
<p>5.<strong>F(ab)=F(a)+F(b)</strong>,where a,b are two positive integers and sum of a and b is minimum.</br>
</p>
<br>Your task is simple.You are to output the value of <strong>F(x)</strong> for the given input integer <strong>x</strong>. </br>
Input
The only line of input contains a single integer <strong>x</strong>.
Output
Output the value of <strong>F(x)</strong>
Example
Input:
<p>
4
</p>
Output:
<p>
4
</p>

CODER SANJAY is now ready to put up his first problem in his favorite website SPOJ.As it is his first problem,he wanted it to be easy so that most of them could get an AC.

The problem statement looks like this:

F(x) is a function whose properties are as follows.

1.F(x)=0 at x=0.

2.F(x)=1 at x=1.

3.F(x)=2 at x=2.

4.F(x)=0 if x is odd prime.

5.F(a*b)=F(a)+F(b),where a,b are two positive integers and sum of a and b is minimum.

Your task is simple.You are to output the value of F(x) for the given input integer x.

CONSTRAINSTS:

0 < x < 100001.

Input

The only line of input contains a single integer x

Output

Output the value of F(x).

Example

Input:

4

Output:

4

 < Previous 1 2 3 4 Next > sunny_chand: 2019-02-26 14:18:37 don't forget that in f(a*b)=f(a)+f(b) ,f(a) and f(b)can further be individually expressed as f(x)+f(y) where x*y=a kushagra_2: 2018-12-15 08:14:42 observe the pattern and you'll get it!!! pranjal1_: 2018-06-27 09:40:16 don't be discouraged ,if you are not able to solve it ,try,try,and keep on trying . It will be done ,just think simple rajcoolaryan: 2018-06-18 09:22:24 f(2) important hai.. Huan Zhou: 2018-05-16 11:20:45 Pretty interesting problem. But the tags are misleading -- just ignore them. dsri_99: 2017-12-20 16:49:21 I suggest not to see comments while solving this problem. It's a quite simple problem.But takes time for the idea to strike. utkarshsingh99: 2017-11-22 21:52:34 Quite easy. Nice usage of recursion. Hint: f(2) is the most important one! yead_025: 2017-10-31 19:23:54 no need to use dp aman_9899: 2017-07-03 22:31:10 game of odd and even..!!!! sushanth_r: 2017-06-15 10:01:16 Numerous ways to solve this problem. 2 Naive Approaches, DP, Recursion.