[Community Puzzle] Factorials of primes decomposition


#1

Hello, i pass the 3 first test cases with succes, but none in the validator cases, can i have an idea about the validators, or only one of them.


#2

I think no one will give here any validator.

May I suggest you to : wait to pass all the test case before submitting and, if needed, ask help directly on #world or #fr or any other channel you want.


#3

I’m in a similar boat, but I’m passing all the test cases and for some reason I’m failing the last validator. I think my code is pretty robust to different combinations to numerators and denominators, but apparently not.

Sorry, I’m a bit of a codingame newbie, and don’t know what this means. Is that related to IRC? I googled #world and it linked back to this forum post.


#4

yep ask help on IRC


#5

The way you have to tackle this is to convert your value into factors of primes, take the largest one and use it as a factorial and then work down from there, note the lowest factorials are 5 : 120, 3 : 6 and 2 :2. I am having trouble using my Python program, the compiler seems to have run out of indentation lines to allocate because I have more than 150 lines of code. How can I ensure it has enough memory or space to complete?


#6

Have you tried your script at home?


#7

Yes it took a long time to develop, now I think it works perfectly(perhaps). Send me some test cases I will return the solutions. I will rewrite it later in C to get it to work on Codinggames.


#8

120
→5#1
54
→3#3 2#-2
5020
→251#1 241#-1 83#-1 79#1 61#-1 59#1 31#-1 29#1 19#-1 17#1 13#-1 11#-1 5#4 3#6 2#3
1/40320
→7#-1 2#-3
96/143
→13#-1 7#1 5#1 3#3 2#5


#9

I get correct answers immediately for 120, 54 and 96/143, because of the geometric nature of calculating factorials and my program requires its calculation locally the solution for 5020 is correct but takes over 2 minutes. I would not attempt 40320 in terms of time because to cover all possibilities the program needs to cover all primes and their factorials upto the value.

Thats the progress so far.


#10

Maybe you are beginning your calculations from the wrong side.


#11

you were so right, I have to generate the factorials after I know the max prime I am to use. Now I get the answer for 5020 immediately and 1/40320 in 3s.

Give me some more to answer without giving the answers, I will send the solns.


#12

3 s for 40320? Look at the primes involved: they are are below 11.