Perfect numbers calculation