RosettaCodeData/Task/Proper-divisors/PicoLisp/proper-divisors-1.l
2023-07-01 13:44:08 -04:00

10 lines
265 B
Text

# Generate all proper divisors.
(de propdiv (N)
(head -1 (filter
'((X) (=0 (% N X)))
(range 1 N) )) )
# Obtaining the values from 1 to 10 inclusive.
(mapcar propdiv (range 1 10))
# Output:
# (NIL (1) (1) (1 2) (1) (1 2 3) (1) (1 2 4) (1 3) (1 2 5))