+ 7

Largest prime factor

Hey guys. I wrote a code to find largest prime factor of a given input, it works perfectly fine but only upto seven digits. How will I be able to get output for larger digits.? https://code.sololearn.com/c566YcPrh8W6/?ref=app

22nd Apr 2019, 2:02 PM
Night_fury~
Night_fury~ - avatar
5 odpowiedzi
+ 4
Night fury you can make use of long long int, int is too small to hold such value your code look so troublesome, like doing lots of unnecessary things https://code.sololearn.com/ceNaeMPuHuwF/?ref=app
23rd Apr 2019, 6:31 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 9
Anya I ran this code on ubuntu terminal. It gave output till 7 digits only. If u can improve this code it would be great.
22nd Apr 2019, 3:23 PM
Night_fury~
Night_fury~ - avatar
+ 8
I tried it on my program by replacing int by long long int.. worked perfectly.. thanks a lot 👍🏻
23rd Apr 2019, 9:36 AM
Night_fury~
Night_fury~ - avatar
+ 5
*AsterisK* need help 😥
23rd Apr 2019, 3:25 AM
Night_fury~
Night_fury~ - avatar
+ 1
The resources to represent the output is attached to the size of your output (in this case specifically). Remember this is plataform dependent. In another system can run 8 digits or less. So if you want to increase the size you can try to: 1: Find a equivalent code that have better performance. 2: Use approximation. This will permit to use less resources but your result will have a percentage of error.
22nd Apr 2019, 2:31 PM
Anya
Anya - avatar