- #1
tiredryan
- 51
- 0
I'm confused about how difficult is it to factor numbers. I am reading that it is used in encryption and it is computationally difficult, but it seems to take O(n) from how I see it.
For example to factor 6, I would
(1) divide by 2 and check if the remainder is 0
(2) divide by 3 and check if the remainder is 0
(3) divide by 4 and check if the remainder is 0
(4) divide by 5 and check if the remainder is 0
For something larger like 30, I would
(1) divide by 2 and check if the remainder is 0
(2) divide by 3 and check if the remainder is 0
...
(28) divide by 29 and check if the remainder is 0
For n, I would
(1) divide by 2 and check if the remainder is 0
(2) divide by 3 and check if the remainder is 0
...
(n-2) divide by 29 and check if the remainder is 0
An algorithm to find the factors seems to be linear.
Is there something that I am missing?
Thanks.
-Ryan
For example to factor 6, I would
(1) divide by 2 and check if the remainder is 0
(2) divide by 3 and check if the remainder is 0
(3) divide by 4 and check if the remainder is 0
(4) divide by 5 and check if the remainder is 0
For something larger like 30, I would
(1) divide by 2 and check if the remainder is 0
(2) divide by 3 and check if the remainder is 0
...
(28) divide by 29 and check if the remainder is 0
For n, I would
(1) divide by 2 and check if the remainder is 0
(2) divide by 3 and check if the remainder is 0
...
(n-2) divide by 29 and check if the remainder is 0
An algorithm to find the factors seems to be linear.
Is there something that I am missing?
Thanks.
-Ryan