Output the nth Even Perfect Number
Jelly, 7 bytes
6Æṣ=$#Ṫ
Try it online!
How it works
6Æṣ=$#Ṫ Main link. Argument: n
6 Set the return value to 6.
# Execute the link to the left with argument k = 6, 7, 8, ... until n
values of k result in a truthy value. Yield the array of matches.
$ Combine the two links to the left into a monadic chain.
Æṣ Compute the sum of k's proper divisors.
= Compare the result with k.
Ṫ Tail; extract the last match.
Mathematica, 13 bytes
Not surprisingly, there is a built-in.
PerfectNumber
Example:
In[1]:= PerfectNumber[18]
Out[1]= 33570832131986724437010877211080384841138028499879725454996241573482158\
> 45044404288204877880943769038844953577426084988557369475990617384115743842\
> 47301308070476236559422361748505091085378276585906423254824947614731965790\
> 74656099918600764404702181660294469121778737965822199901663478093006075022\
> 35922320184998563614417718592540207818507301504509772708485946474363553778\
> 15002849158802448863064617859829560720600134749556178514816801859885571366\
> 09224841817877083608951191123174885226416130683197710667392351007374503755\
> 40335253147622794359007165170269759424103195552989897121800121464177467313\
> 49444715625609571796578815564191221029354502997518133405151709561679510954\
> 53649485576150660101689160658011770193274226308280507786835049549112576654\
> 51011967045674593989019420525517538448448990932896764698816315598247156499\
> 81962616327512831278795091980742531934095804545624886643834653798850027355\
> 06153988851506645137759275553988219425439764732399824712438125054117523837\
> 43825674443705501944105100648997234160911797840456379499200487305751845574\
> 87014449512383771396204942879824895298272331406370148374088561561995154576\
> 69607964052126908149265601786094447595560440059050091763547114092255371397\
> 42580786755435211254219478481549478427620117084594927467463298521042107553\
> 17849183589266903954636497214522654057134843880439116344854323586388066453\
> 13826206591131266232422007835577345584225720310518698143376736219283021119\
> 28761789614688558486006504887631570108879621959364082631162227332803560330\
> 94756423908044994601567978553610182466961012539222545672409083153854682409\
> 31846166962495983407607141601251889544407008815874744654769507268678051757\
> 74695689121248545626112138666740771113961907153092335582317866270537439303\
> 50490226038824797423347994071302801487692985977437781930503487497407869280\
> 96033906295910199238181338557856978191860647256209708168229116156300978059\
> 19702685572687764976707268496046345276316038409383829227754491185785965832\
> 8888332628525056
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.
Try it online!
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)