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
;; P36 (**) Determine the prime factors of a given positive integer (2). | |
;; Construct a list containing the prime factors and their multiplicity. | |
;; Example: | |
;; * (prime-factors-mult 315) | |
;; ((3 2) (5 1) (7 1)) | |
;; Hint: The problem is similar to problem P13. | |
#lang racket | |
(provide prime-factors-mult) | |
(require "p10.ss") | |
(require "p35.ss") | |
(define (prime-factors-mult n) | |
(map reverse (encode (prime-factors n)))) |
0 件のコメント:
コメントを投稿