John Benediktsson
dd2a5729a7
math.primes.erato: bit faster by inlining.
2012-08-23 09:35:09 -07:00
John Benediktsson
cf54ce8e42
math.functions: when gcd is inlined, "gcd nip" is almost as good as "gcd*".
2011-10-18 10:30:39 -07:00
John Benediktsson
ac98269f53
math.functions: faster gcd means faster ratios.
2011-10-17 20:36:28 -07:00
John Benediktsson
81714b8dc3
More lint cleanups.
2011-10-16 19:33:16 -07:00
John Benediktsson
b653360299
math.primes.safe: fix docs.
2011-09-12 10:56:39 -07:00
John Benediktsson
9f34c9c676
Spelling fixes to documentation.
2011-08-26 16:20:31 -07:00
Samuel Tardieu
23fe76160a
Add math.primes:nprimes
2011-05-20 12:38:27 +02:00
Jon Harper
f60f13c675
math.primes.erato doc fixes.
2010-11-02 17:34:28 +01:00
Rupert Swarbrick
cd28c7a219
math.primes.erato: Fix off-by-one error
...
The sieve bit vector deals with numbers in chunks of 30. Therefore,
the number 90 (say) is the 91st 'element' of the vector. Each byte
deals with some range {0,1,...,29}+30n so to have the number 90, you
need four bytes.
Rather pleasingly, I bumped into this bug and it reduced to the
incantation:
2010 2010 sieve marked-prime?
2010-11-02 17:34:24 +01:00
Slava Pestov
ee1520f683
math.primes.erato: fix typo in docs
2010-10-22 18:26:08 -07:00
Jon Harper
4fcdb2fbd5
divisors returns empty list for 0
...
This is mainly for consistency with other words
(factors, group-factors, unique-factors)
2010-08-09 22:54:35 -07:00
Samuel Tardieu
b3a866173a
Fix "primes-between" and "primes-upto" with pathological bounds.
...
"primes-between" was buggy when bounds were given in the wrong order
or when the high bound was smaller than 3.
2010-06-11 16:07:52 +02:00
Doug Coleman
bdecd564a3
Use keys/values where appropriate
2010-05-21 12:48:04 -05:00
Doug Coleman
4c71d71907
random is generic now -- iota random -> random
2010-01-14 12:48:57 -06:00
Slava Pestov
df4fb4a3ee
Removing integers-as-sequences
2010-01-15 07:15:33 +13:00
Doug Coleman
ae9bca2b1e
add MAIN: run-unix-factor to math.primes.factors
2009-12-12 23:39:59 -06:00
Slava Pestov
0612bc6177
Factor source files should not be executable
2009-11-21 17:50:43 -06:00
Doug Coleman
1d12a6707d
sigma -> map-sum
2009-10-29 14:34:04 -05:00
Joe Groff
6e1bffb1c5
update existing code to use :> ( ) when possible
2009-10-28 16:11:33 -05:00
Doug Coleman
1b4e3cb7a6
fix more docs typos
2009-10-21 18:11:24 -05:00
Keith Lazuka
405e5d015b
docs: change $subsection to $subsections
2009-10-02 12:15:48 -04:00
Samuel Tardieu
d23286a9ef
Do not repeat sanity tests at each iteration
2009-09-09 21:35:24 +02:00
Samuel Tardieu
21a89bab0e
Make "divisors" work with 1 as well
2009-09-02 12:07:23 +02:00
Samuel Tardieu
e5897d52b2
Ensure that random-prime result has the right size
...
As noted by Slava, choosing the next prime following a random number
with a specified number of bits may give a number one more bit long.
2009-08-29 21:42:15 +02:00
Doug Coleman
3f3d57032b
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places, minor refactoring
2009-08-13 19:21:44 -05:00
Doug Coleman
4a3d63e00a
use if-zero in a few more places
2009-08-11 18:15:53 -05:00
Samuel Tardieu
4d5392fe56
Add divisors to math.primes.factors
2009-06-29 16:56:00 +02:00
Samuel Tardieu
094c82c50b
Short circuit trivial composites
2009-06-24 15:53:50 +02:00
Samuel Tardieu
50191588e4
Get rid of vector reallocation by preallocating it
2009-06-24 15:53:46 +02:00
Samuel Tardieu
29b5a1dff5
Add extra tests for math.primes
2009-06-24 13:15:13 +02:00
Samuel Tardieu
41d804ddbd
Pack primes numbers by slices of 30
...
In any given 30 successive integers greater than 5, there are at most
8 prime numbers. Use this to tightly pack the result of the Eratostene
sieve. This lets us store more prime numbers than before in less space.
2009-06-24 13:15:12 +02:00
Doug Coleman
23e3c55d2f
dont load safe primes in miller rabin tests
2009-05-10 14:08:03 -05:00
Doug Coleman
e946777fbb
link to prime tests from prime docs
2009-05-10 14:01:21 -05:00
Doug Coleman
bfb3507456
make a new vocabulary for safe primes
2009-05-10 13:49:40 -05:00
Doug Coleman
8f51f87a8f
more docs for math.primes, move words out of miller-rabin
2009-05-10 13:47:51 -05:00
Doug Coleman
0801dbc694
add lucas-lehmer primality test
2009-05-10 12:59:35 -05:00
Doug Coleman
79265b50d9
update usages of miller-rabin
2009-05-10 12:24:43 -05:00
Doug Coleman
6b1f60f550
move math.miller-rabin to math.primes.miller-rabin
2009-05-10 12:24:19 -05:00
Aaron Schaefer
ed9a63311c
Fix typo and update a combinator usage in calendar
2009-04-01 22:03:45 -04:00
Aaron Schaefer
ca9fb1fcf1
Update usages of divisor? where appropriate
2009-04-01 21:53:18 -04:00
Samuel Tardieu
b5e08a8e3e
When a factor has been found, check if the remainder is a prime number
...
Performances are greatly increased when a large prime number is involved.
Also, mark some words as flushable, even if it is unlikely that they
will be invoked if their result is discarded.
2009-03-02 19:05:54 +01:00
Samuel Tardieu
087d931c36
Remove the tail argument from do/until/while
2009-02-18 02:41:14 +01:00
Samuel Tardieu
0069547e90
Fix suboptimal prime number factoring
2009-02-03 00:33:12 +01:00
Samuel Tardieu
6a2f46ed7f
Move math.primes.factors from extra to basis
2009-01-07 23:01:27 +01:00
Samuel Tardieu
594bd3aee8
Move math.primes from extra to basis
2009-01-07 21:12:48 +01:00