>>5
Only that's the slowest implementation you can think of. (that, and your Lisp DSL does not exist)
>>1
There's some redundancy in your code: try range(1, x+1) instead of just skipping 0 with a continue statement and use return len(y) == 2 instead of an if-statement.
>>6
Thanks for the tip. Instead of using the number of factors I was thinking of using a search function to see if the only factors were 1 and itself but that'd probably be worse.
Name:
Anonymous2011-03-20 10:31
hi i implemeted square root but it doesnt work well why???
(define (square_root number)
(define (square_root_loop number index)
(if (= (* index index) number) index (square_root_loop number (+ index 1)
)
)
)
(square_root_loop number 0)
)
Tomorrow look for in a Web book Dive into python. Fuck if you do not understand. Then you go to python.org and learn the standard library from cover to cover. Then, bison, namely, female, notch convention for writing Python code - PEP8, that bounced away from the teeth. When you write your first imidzhbordu on the way to studying layout html + css, download and study any python asynchronous web server, I recommend Tornado or Gevent. How to remake imidzhbordu to issue at least 5,000 requests per second, you can go further - you'll get a fascinating world hayloada. Apache Hadoop, ultrafast asynchronous key-value store, MapReduce. Suction Hickey vyblyadkov / just unlucky or type reyfaga sisyarp / java-cocksucker who suck dick for life will not take long and within half a year you will receive such amounts that any woman will be flowing at the mere mention of your salary.
For extra speed you could find all prime numbers under reasonable bound and hardcoded them in an array in your code. With this, you could check, if searched number is in array by using binary search. If yes, it's prime, if not, it isn't. That would be really fast. For number over bound you could use your algorithm.