### 10856 - Recover Factorial

Posted:

**Sat May 28, 2005 4:08 pm**How is this problem solved? It appears everybody but me solved it

Page **1** of **2**

Posted: **Sat May 28, 2005 4:08 pm**

How is this problem solved? It appears everybody but me solved it

Posted: **Sat May 28, 2005 4:27 pm**

I want to know,also. I can't solve this problem in 2s.

Tell me and Bik how to solve the problem.

Tell me and Bik how to solve the problem.

Posted: **Sun May 29, 2005 6:45 am**

Hi

I have solve this problem by this way

- First i have stored some prime number

- Then i have stored number of factor's in a single number by using DP.

- Then binary search

Thanks

MAP

I have solve this problem by this way

- First i have stored some prime number

- Then i have stored number of factor's in a single number by using DP.

- Then binary search

Thanks

MAP

Posted: **Mon May 30, 2005 2:23 pm**

Sorry, I got WA all the time.mohiul alam prince wrote:Hi

I have solve this problem by this way

- First i have stored some prime number

- Then i have stored number of factor's in a single number by using DP.

- Then binary search

MAP

Could you give me some tricky input/output?

Thx

Posted: **Mon May 30, 2005 2:50 pm**

Maybe this, in the problem statement is:

A negative integer marks is the end of input, not -1. I have 2 WAs becouse of that...

A negative integer marks is the end of input, not -1. I have 2 WAs becouse of that...

Posted: **Mon May 30, 2005 3:22 pm**

I have noticed the point.Monsoon wrote:Maybe this, in the problem statement is:

A negative integer marks is the end of input, not -1. I have 2 WAs becouse of that...

When I input 0, it is impossible or 1! ?

Posted: **Mon May 30, 2005 3:26 pm**

neither of them, i output 0 (0!=1) and it is the smallest number

Posted: **Tue May 31, 2005 8:36 am**

Hi

Try this Input

Input
Output
I think this is the most tricky Input for this problem.

Thanks

MAP

Try this Input

Input

Code: Select all

```
0
1
10000001
-200
```

Code: Select all

```
Case 1: 0!
Case 2: 2!
Case 3: 2703663!
```

Thanks

MAP

Posted: **Thu Jul 07, 2005 8:29 pm**

0! = 1

am i right? i think so is not possible this case.

am i right? i think so is not possible this case.

Posted: **Wed Jul 27, 2005 5:13 am**

I tried to store prime upto 2703663 and it take 1.6 MB.mohiul alam prince wrote:Hi

I have solve this problem by this way

- First i have stored some prime number

- Then i have stored number of factor's in a single number by using DP.

- Then binary search

Thanks

MAP

Can you write details?

Posted: **Wed Jul 27, 2005 12:15 pm**

Hi ibrahim

suppose you have a list of prime number

- prime[] = {2,3,5,7,11,13,17,19,23,29,............................}

- and my concept is if a number is divisible by a prime number then it is suffice for find out total number of prime factor.

exp - if we have a number 12

then we have to check which prime number is divisible then 2 will be come and

then ans will be Table* = Table[i / prime[j]] + Table[prime[j]]; *

here i = 12

prime[j] = 2

then Table[12] = Table[12/2] + Table[2]

then we can easily find out Table[12] = 3:-?

and it will be continue up to 2703665

- then binary search

thanks

MAP

suppose you have a list of prime number

- prime[] = {2,3,5,7,11,13,17,19,23,29,............................}

- and my concept is if a number is divisible by a prime number then it is suffice for find out total number of prime factor.

exp - if we have a number 12

then we have to check which prime number is divisible then 2 will be come and

then ans will be Table

here i = 12

prime[j] = 2

then Table[12] = Table[12/2] + Table[2]

then we can easily find out Table[12] = 3:-?

and it will be continue up to 2703665

- then binary search

thanks

MAP

Posted: **Sat Aug 20, 2005 11:39 am**

Table= Table[i / prime[j]] + Table[prime[j]];

what does this table contain at last...

how does it help....

plz, give me explanations and some starting values in the generated table

Thanks !

Posted: **Thu Apr 13, 2006 4:35 am**

I don't understand too

12 has another prime factor is 3 then table[12] = table[4] + table[3] + table[6] + table[2] ?

some little more details please?

12 has another prime factor is 3 then table[12] = table[4] + table[3] + table[6] + table[2] ?

some little more details please?

Posted: **Tue Jul 04, 2006 10:51 am**

The table at last is like this:
This means the number's "factors" --> I don't know whether this word or not

Example

8 = 2 * 2 * 2

So Table[8]=3

to FAQ:
means
and obviously not equal to Table [12].

By the way, it's not necessary to calculate prime numbers.

Code: Select all

```
Table[0]=0
Table[1]=0
Table[2]=1
Table[3]=1
Table[4]=2
Table[5]=1
Table[6]=2
Table[7]=1
Table[8]=3
...
```

Example

8 = 2 * 2 * 2

So Table[8]=3

to FAQ:

Code: Select all

`Table[4]+Table[3]+Table[6]+Table[2]`

Code: Select all

`Table [ 4 * 3 * 6 * 2 ] = Table[144]`

By the way, it's not necessary to calculate prime numbers.

Posted: **Sun Jul 30, 2006 6:35 am**

Can anybody post some testcases? My code seems to be correct but still WA.

now I got it, I didn't print the '.' !!!

now I got it, I didn't print the '.' !!!