# \[Blog Post\] A Fun Exploration of Perfect, Abundant, and Deficient Numbers

**URL:** https://discourse.julialang.org/t/blog-post-a-fun-exploration-of-perfect-abundant-and-deficient-numbers/99168
**Category:** General Usage
**Tags:** question, numbers, blog-post, math
**Created:** [May 20, 2023, 4:41pm UTC](https://discourse.julialang.org/t/blog-post-a-fun-exploration-of-perfect-abundant-and-deficient-numbers/99168 "2023-05-20T16:41:06Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [May 22, 2023, 3:44pm UTC](https://discourse.julialang.org/t/blog-post-a-fun-exploration-of-perfect-abundant-and-deficient-numbers/99168/4 "2023-05-22T15:44:37Z")

</div>

yes, but of course they are much slower than native machine types (e.g. Int64/Float64)

I have recoded the first part of your post using them… I am not a “big” user of them, so I do not think all the specification I added are needed, I think Julia automatically recast operations between Int and BigInt to a BigInt for example, still… this seems to work:

```julia
using Pkg
Pkg.activate(temp=true)
Pkg.add("Primes")

import Primes: factor

function divisors(n)
    d = BigInt[BigInt(1)]
    for (p, e) in factor(n)
        t = BigInt[]
        r = BigInt(1)
        for i in BigInt(1):e
            r *= p
            for u in d
                push!(t, u * r)
            end
	    end
	append!(d, t)
    end
    return sort!(d)
end

i = BigInt(1) 
deficient_numbers = BigInt[]
abundant_numbers = BigInt[]
while true
  divisor_sum = divisors(i)[1:end-1] |> sum
  if divisor_sum < i && length(deficient_numbers) != 1000
    push!(deficient_numbers, i)
  elseif divisor_sum > i && length(abundant_numbers) != 1000
    push!(abundant_numbers, i)
  end
  i += BigInt(1)
  length(abundant_numbers) == 1000 && length(deficient_numbers) == 1000 ? break : continue
end

```

---

_[View the full topic](https://discourse.julialang.org/t/blog-post-a-fun-exploration-of-perfect-abundant-and-deficient-numbers/99168)._
