This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

## 2022-10-02

## Channels

I would like to find abundant number. so 12 is an abundant number as its divisors are 1, 2, 3, 4, 6, and 12, totaling 28. I am trying to write a function, abundance, that has one argument, an integer, and returns the sum of the proper divisors of the number minus the number itself. For example, (abundance 12) should return 4.

sounds like a code-academy problem. almost all the problems on code academy have detailed wikipedia solutions for their problems

I was able to find divisor

```
(defn divisor [integer]
(into [] (filter (fn [x] (zero? (mod integer x))) (range 1 (inc integer)))))
```

Don't you only need to find divisors upto half of `n`

?
i.e. if you can divide 12 by 2, then you have know divisors 2 and 6. So your range can be smaller.

I am thinking adding what I got from divisor function then minus the last num * 2. I get (divisor 12) => [1 2 3 4 6 12] So add them up and do 28 - (12*2) ??

@U0LAJQLQ1 I didn't think Codecademy had any Clojure courses?

@U04V70XH6 no, they don't. i didn't know that they had courses either. from my experience (mostly with project Euler) a good place to start with problems like this is on wikipedia. in this case there are 2 definitions for the type of number, neither provided by the original question posted.

This https://clojurians-log.clojureverse.org/beginners/2022-10-02 (on my phone otherwise I'd give a more accurate link)

@U044TFZTBRA please don't delete your questions after they've been answered.

Here's a direct link to the OP question for this thread: https://clojurians-log.clojureverse.org/beginners/2022-10-02/1664674023.842049 -- I'm going to drop a similar link into the other thread. And here's the text from the OP: I would like to find abundant number. so 12 is an abundant number as its divisors are 1, 2, 3, 4, 6, and 12, totaling 28. I am trying to write a function, abundance, that has one argument, an integer, and returns the sum of the proper divisors of the number minus the number itself. For example, (abundance 12) should return 4.