Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have an O(N) algorithm for factoring any prime: Read each digit of the prime from the input tape and write it to the output tape. :P

(Perhaps you meant factoring large semi-primes? :) )



I have an O(1) then!


Given that you have to read and then write each digit of the input I find it hard to believe that you have an O(1) algorithm - can you tell us what it is?


Take a photo of the input on the tape and print the photo.


Depending of the size of the prime you might need to take multiple photos.


Print "1", thought that would be obvious...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: