Created
October 9, 2022 20:06
-
-
Save dannypsnl/fc7a41b53ef8b5bdde07b847d69f0083 to your computer and use it in GitHub Desktop.
all factors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define prime-list '(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59)) | |
(define (factor-list n) | |
(define p-factor-list | |
(for/list ([p prime-list] | |
#:when (= (remainder n p) 0)) | |
p)) | |
(println p-factor-list) | |
(for/list ([c (in-combinations p-factor-list)]) | |
(for/product ([n c]) | |
n))) | |
(factor-list 60) | |
(factor-list 10) | |
(factor-list 13) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment