Fixed next-prime and prev-prime problem
This commit is contained in:
parent
7e89adece4
commit
db500e8b58
|
@ -3,7 +3,7 @@
|
||||||
(require typed/untyped-utils
|
(require typed/untyped-utils
|
||||||
"private/number-theory/divisibility.rkt"
|
"private/number-theory/divisibility.rkt"
|
||||||
"private/number-theory/modular-arithmetic.rkt"
|
"private/number-theory/modular-arithmetic.rkt"
|
||||||
"private/number-theory/number-theory.rkt"
|
(except-in "private/number-theory/number-theory.rkt" prev-prime next-prime)
|
||||||
(except-in "private/number-theory/factorial.rkt" factorial permutations)
|
(except-in "private/number-theory/factorial.rkt" factorial permutations)
|
||||||
"private/number-theory/bernoulli.rkt"
|
"private/number-theory/bernoulli.rkt"
|
||||||
"private/number-theory/eulerian-number.rkt"
|
"private/number-theory/eulerian-number.rkt"
|
||||||
|
@ -25,6 +25,11 @@
|
||||||
"private/number-theory/binomial.rkt"
|
"private/number-theory/binomial.rkt"
|
||||||
[binomial (Integer Integer -> Natural)])
|
[binomial (Integer Integer -> Natural)])
|
||||||
|
|
||||||
|
(require/untyped-contract
|
||||||
|
"private/number-theory/number-theory.rkt"
|
||||||
|
[next-prime (Integer -> Integer)]
|
||||||
|
[prev-prime (Integer -> Integer)])
|
||||||
|
|
||||||
(provide (all-from-out
|
(provide (all-from-out
|
||||||
"private/number-theory/divisibility.rkt"
|
"private/number-theory/divisibility.rkt"
|
||||||
"private/number-theory/modular-arithmetic.rkt"
|
"private/number-theory/modular-arithmetic.rkt"
|
||||||
|
@ -40,5 +45,6 @@
|
||||||
"private/number-theory/quadratic.rkt"
|
"private/number-theory/quadratic.rkt"
|
||||||
"private/number-theory/quadratic-residues.rkt"
|
"private/number-theory/quadratic-residues.rkt"
|
||||||
"private/number-theory/tangent-number.rkt")
|
"private/number-theory/tangent-number.rkt")
|
||||||
|
next-prime prev-prime
|
||||||
factorial permutations
|
factorial permutations
|
||||||
binomial)
|
binomial)
|
||||||
|
|
|
@ -193,22 +193,16 @@ Returns the n'th positive prime.
|
||||||
Returns the first prime larger than @racket[z].
|
Returns the first prime larger than @racket[z].
|
||||||
|
|
||||||
@interaction[#:eval untyped-eval
|
@interaction[#:eval untyped-eval
|
||||||
(untyped-next-prime 4)
|
(next-prime 4)
|
||||||
(untyped-next-prime 5)]
|
(next-prime 5)]
|
||||||
|
|
||||||
Note: Use @racket[next-prime] in Typed Racket and
|
|
||||||
@racket[untyped-next-prime] otherwise.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@defproc[(prev-prime [z Integer]) prime?]{
|
@defproc[(prev-prime [z Integer]) prime?]{
|
||||||
Returns the first prime smaller than @racket[z].
|
Returns the first prime smaller than @racket[z].
|
||||||
|
|
||||||
@interaction[#:eval untyped-eval
|
@interaction[#:eval untyped-eval
|
||||||
(untyped-prev-prime 4)
|
(prev-prime 4)
|
||||||
(untyped-prev-prime 5)]
|
(prev-prime 5)]
|
||||||
|
|
||||||
Note: Use @racket[prev-prime] in Typed Racket and
|
|
||||||
@racket[untyped-prev-prime] otherwise.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@defproc[(next-primes [z Integer] [n Natural]) (Listof prime?)]{
|
@defproc[(next-primes [z Integer] [n Natural]) (Listof prime?)]{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user