Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Anti-primes/Racket/anti-primes.rkt
Normal file
16
Task/Anti-primes/Racket/anti-primes.rkt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#lang racket
|
||||
|
||||
(require racket/generator
|
||||
math/number-theory)
|
||||
|
||||
(define (get-divisors n)
|
||||
(apply * (map (λ (factor) (add1 (second factor))) (factorize n))))
|
||||
|
||||
(define antiprimes
|
||||
(in-generator
|
||||
(for/fold ([prev 0]) ([i (in-naturals 1)])
|
||||
(define divisors (get-divisors i))
|
||||
(when (> divisors prev) (yield i))
|
||||
(max prev divisors))))
|
||||
|
||||
(for/list ([i (in-range 20)] [antiprime antiprimes]) antiprime)
|
||||
Loading…
Add table
Add a link
Reference in a new issue