primes
Fastest prime test for small-ish numbers
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[详细]
2023-01-17 09:22 分类:问答Confused on Miller-Rabin
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[详细]
2023-01-17 00:43 分类:问答Converting prime numbers [duplicate]
This question already has 开发者_运维百科answers here: Closed 12 years ago. Possible Duplicate: Help with algorithm problem from SPOJ[详细]
2023-01-15 14:18 分类:问答Generating all factors of a number given its prime factorization
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,[详细]
2023-01-14 17:04 分类:问答Lazy List of Prime Numbers
How would one implement a list of prime numbers in Haskell so that they could be retri开发者_运维知识库eved lazily?[详细]
2023-01-14 14:04 分类:问答Learning Haskell: Seemingly Circular Program - Please help explain
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[详细]
2023-01-11 19:24 分类:问答Project Euler #10, java [duplicate]
This question already has answers here: Closed 10 years ago. Possible Duplicate: Project Euler, Problem 10 java solution not working[详细]
2023-01-10 14:44 分类:问答How does this regular expression work?
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[详细]
2023-01-08 14:22 分类:问答Improving pure Python prime sieve by recurrence formula
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[详细]
2023-01-08 04:15 分类:问答Prime Number Formula
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[详细]
2023-01-08 04:11 分类:问答