Perfect Number Generator

Finds even perfect numbers [ppN(:,3)] for each relevant prime <= P.
517 download
Aggiornato 12 gen 2010

Visualizza la licenza

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

Cita come

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

Compatibilità della release di MATLAB
Creato con R2009b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Discrete Math in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
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