Calculate the largest number(in base 10) less than 1500000 which is a factorion number in base b. e.g. base=11, 26 is a factorion because 26 in base 11 is 24 and 2! + 4! = 26.
# | User | Rating |
---|---|---|
1 | tourist | 3690 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 165 |
3 | adamant | 161 |
4 | TheScrasse | 160 |
5 | nor | 158 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 152 |
8 | orz | 146 |
9 | SecondThread | 145 |
9 | pajenegod | 145 |
Calculate the largest number(in base 10) less than 1500000 which is a factorion number in base b. e.g. base=11, 26 is a factorion because 26 in base 11 is 24 and 2! + 4! = 26.
Name |
---|
problem link?
I don't have link it was asked previously in exam as told by my college senior
the first thing anyone does and should is to confirm whether this is a live contest problem or not , that's the only reason I asked you to provide link.
since you do not have link yourself , there is no way to verify this , so unfortunately can not help.
what can be done about it?
since you asked the question yesterday , you can wait for like 9 more days (no contest i know which runs more than 10 days) , after that people can help (i have one solution in mind too).
and apologies for not being able to help for now.
I hope you understand.
Can you explain it now? Or anyone who could figure it out ?
I had no idea why my contribution points were going down and thanks to this guy's comment now I know (since I commented 3 months ago I didn't knew there was something I need to answer).
it is more of an implementation problem , the toughest part of it will be to convert a given number in base 10 to base b (so you can understand this is not that difficult problem).
so here is how we can solve this problem.
pre calculate factorials from 0 to 9 (because we only need factorial of digits).
run a loop from 1500000 — 1 to 0 and check whether the current number is factorian number or not.
if the current number is factorian number stop the loop and print current number.
step 2 requires to check whether the given number is factorian number or not , for that you need to convert the current number from base 10 to base b after that you can easily check that.
I am providing the code , you can check the implementation details there.
code link : https://ideone.com/qe0RGm
for base b = 11 , biggest factorial number less than the specified limit is 40472.
I recommand just do a brute force with precalculated factorial table