Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (primo? n)
- (cond
- ((= n 1) #t)
- (else
- (primo-aux n 2)
- )
- )
- )
- (define (primo-aux n d)
- (cond
- ((= n d) #t)
- ((zero? (remainder n d)) #f)
- (else
- (primo-aux n (+ d 1))
- )
- )
- )
- (define (tabla-primos i n)
- (cond
- ((= i n) (display "Fin de la lista"))
- (else
- (cond
- ((primo? i)
- (display i)
- (display " Es primo\n")
- )
- )
- (tabla-primos (+ i 1) n)
- )
- )
- )
- (tabla-primos 1 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement