private int getAmicableNumberSumUnder(int limit) {
        Map<Integer, Integer> map = new LinkedHashMap<>(limit - 1);
        for (int i = 1; i < limit; i++) {
            map.put(i, getSumOfFactors(i));
        }
        int total = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            int sum = entry.getValue();
            if (sum > entry.getKey() && sum < limit && map.get(sum).equals(entry.getKey())) {
                total += entry.getKey() + entry.getValue();
            }
        }
        return total;
    }