28 de dez. de 2025

Problem 21

Amicable numbers

Let σ(n)\sigma(n) be defined as the sum of proper divisors of nn (numbers less than nn which divide evenly into nn). If σ(a)=b\sigma(a) = b and σ(b)=a\sigma(b) = a, where aba \neq b, then aa and bb are an amicable pair and each of aa and bb are called amicable numbers.

For example, the proper divisors of 220220 are 1,2,4,5,10,11,20,22,44,551, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110110; therefore σ(220)=284\sigma(220) = 284. The proper divisors of 284284 are 1,2,4,71,1421, 2, 4, 71, 142; so σ(284)=220\sigma(284) = 220.

Evaluate the sum of all the amicable numbers under 1000010000.

Conceito

Outra vez essa parada de divisores...

Tentativa 1 - 27/12/2025

Fazer uma função X que receba um número e retorne a soma de seus divisores = Y. Verificar se f(Y) = X e X != Y.

Foi relativamente de boa

JavaScript REPL

Recent Articles

Advent of Code 2025 - 01
Desafios
Added on: 28 de dez. de 2025
Sobre Project Euler
Desafios
Added on: 28 de dez. de 2025
Problem 20
Desafios
Added on: 28 de dez. de 2025
Problem 21
Desafios
Added on: 28 de dez. de 2025
Problem 22
Desafios
Added on: 28 de dez. de 2025

© 2026