I\'m playing through project Euler in my spare time, and it\'s come to the point where开发者_运维知识库 I need to do some refactoring. I\'ve implemented Miller-Rabin, as well as a few sieves. I\'ve he
As an exercise for myself, I\'m implementing the Miller-Rabin test. (Working through SICP). I understand Fermat\'s little theorem and was able to successfully implement that. The part that I\'m gettin
This question already has 开发者_运维百科answers here: Closed 12 years ago. Possible Duplicate: Help with algorithm problem from SPOJ
If you already have the prime factorization of a number, what is the easiest way to get the set of all factors of that number?I know I could just loop from 2 to sqrt(n) and find all divisible numbers,
How would one implement a list of prime numbers in Haskell so that they could be retri开发者_运维知识库eved lazily?
I\'m currently going through the book \"The Haskell Road to Logic, Math, and Programming\" by Doets and Van Eijck. I\'ve never been exposed to any functional programming language until this book, so k
This question already has answers here: Closed 10 years ago. Possible Duplicate: Project Euler, Problem 10 java solution not working
From this article, /^1?$|^(11+?)\\1+$/ checks whether a number(its value in unary) is prime or not. Using this, perl -l -e \'(1 x $_) !~ /^1?$|^(11+?)\\1+$/ && print while ++$_;\' returns a
I am trying to optimize further the champion solution in prime number thread by taking out the complex formula for sub-list length. len() of the same subsequence is too slow as len is expensive and ge
I am trying to write a prime number function in C# and I am wondering if the follow code will work. It \"appears\" to work with the first 50 numbers or so. I just want to make sure it will work no mat