-4

suppose in the question its is given 1<=n<10^6. Most appropriately we have to take a string of that size. we can globally declare like this: char A[1000001] Here last digit as 1 signify for the null character.

But i have seen people declaring array like this:char A[1000010]

Why so?what is the reason behind it?trust me I got AC after Declaring the array declaration of the 2nd type

Aniruddha Paul
  • 119
  • 1
  • 10
  • possible duplicate of [Largest prime factor of a number](http://stackoverflow.com/questions/23287/largest-prime-factor-of-a-number) – pola sai ram May 10 '15 at 11:15
  • This is the [second time](http://stackoverflow.com/questions/30148348/finding-prime-factors-of-1018) you have posted this question today. Please don't post the same question multiple times. – BJ Myers May 10 '15 at 16:42
  • The prime divisors of `n` where `1≤n≤10^18` are the primes numbers less than `10^18`. I assume you're trying to figure out something else. But you need to figure out what you actually want to know, and not keep asking the same question. Especially once it gets put on hold, since that is disrespecting the rest of the SO community. – Teepeemm May 10 '15 at 20:55

1 Answers1

4

No, there is no efficient way to do it. This is a hard problem to solve. In fact, this problem's complexity is the base of secure asymmetric algorithms such as RSA which make SSL (HTTPS) possible.

Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
  • This answer is misleading. It would not be secure at all to base your cryptographic system on the idea that people can't factor 18 digit numbers. Trial division would be feasible, and there are more efficient approaches than trial division. – Douglas Zare May 10 '15 at 16:53