MATL, 15 bytes
`@Z\s@E=vtsG<}n
Very slow. It keeps trying increasing numbers one by one until the n-th perfect number is found.
Explanation
` % Do...while
@ % Push iteration index, k (starting at 1)
Z\ % Array of divisors
s % Sum
@E % Push k. Multiply by 2
= % Equal? If so, k is a perfect number
v % Concatenate vertically. This gradually builds an array which at the k-th
% iteration contains k zero/one values, where ones indicate perfect numbers
ts % Duplicate. Sum of array
G< % Push input. Less than? This is the loop condition: if true, proceed with
% next iteration
} % Finally (execute right before exiting loop)
n % Number of elements of the array
% End (implicit). Display (implicit)
MATL, 15 bytes
`@Z\s@E=vtsG<}n
Very slow. It keeps trying increasing numbers one by one until the n-th perfect number is found.
MATL, 15 bytes
`@Z\s@E=vtsG<}n
Very slow. It keeps trying increasing numbers one by one until the n-th perfect number is found.
Explanation
` % Do...while
@ % Push iteration index, k (starting at 1)
Z\ % Array of divisors
s % Sum
@E % Push k. Multiply by 2
= % Equal? If so, k is a perfect number
v % Concatenate vertically. This gradually builds an array which at the k-th
% iteration contains k zero/one values, where ones indicate perfect numbers
ts % Duplicate. Sum of array
G< % Push input. Less than? This is the loop condition: if true, proceed with
% next iteration
} % Finally (execute right before exiting loop)
n % Number of elements of the array
% End (implicit). Display (implicit)
MATL, 15 bytes
`@Z\s@E=vtsG<}n
Very slow. It keeps trying increasing numbers one by one until the n-th perfect number is found.