nums2.py

Created by chick-chicky

Created on March 21, 2023

551 Bytes


from math import *
from math_stuff import *

LIMIT = 100

pr = primes(LIMIT)

print(
'''
P: prime
p: perfect
q: almost perfect
'''
)

print('{} FLAGS DIVISORS'.format("NUM".rjust(max(3,ceil(log10(LIMIT)))," ")))

for i in range(1,LIMIT):
    flags = [
        'P' if (i in pr) else ' ',
        'p' if (is_perfect(i)) else 'q' if (is_almost_perfect(i)) else ' ',
        ' ', # empty
        ' ', # empty
        ' '  # empty
    ]
    print(str(i).rjust(max(3,ceil(log10(LIMIT))),' '),''.join(flags),', '.join(map(str,divisors(i,True))))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.