id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

peter@norvig.com > perfects
prev  |  next  |  chance

Given an integer n, return a list of all the perfect numbers less than n. A perfect number is one whose proper divisors (not including the number itself) sum to the number. For example, 6 is perfect because its proper divisors are [1, 2, 3], and 1+2+3 == 6.


perfects(5) → []
perfects(10) → [6]
perfects(27) → [6]

...Save, Compile, Run (ctrl-enter)

def perfects(n):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 251 Post-solution available

Copyright Nick Parlante 2017 - privacy