Perfect Number Generator

Finds even perfect numbers [ppN(:,3)] for each relevant prime <= P.
517 téléchargements
Mise à jour 12 jan. 2010

Afficher la licence

It calculates perfect even #'s with 2^(p-1)*(2^p - 1) where p and (2^p - 1)
%are prime. A subsequent run yields a faster run-time. The code is fully
%vectorized and hence cleaner than previous versions of the function.
%NB: if (2^p - 1) is a Mersenne prime then a perfect number has been found.
%
%SYNTAX: >> perf_finalv4(P) % where P is an integer scalar in
%useful inclusive range [2..31].
%i.e. run showing first 8 perfect numbers...
%>> p = perf_finalv4(31);
%>> [p(:,3)]
%
% ans =
%
% 6
% 28
% 496
% 8128
% 33550336
% 8589869056
% 137438691328
% 2.30584300813995e+018

Citation pour cette source

Bruce Raine (2024). Perfect Number Generator (https://www.mathworks.com/matlabcentral/fileexchange/26314-perfect-number-generator), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2009b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Discrete Math dans Help Center et MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.3.0.0

Corrected comments in function header i.e.
%2^43,112,608 × (2^43,112,609 - 1)
and also spelling typo. NB: neither change affects the function's performance.

1.0.0.0