Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding perfect numbers
#2
I would have used not number % divisor, and not bothered with the divides function.

Also, your code does work right. It returns False for 6. Going to the sqrt(n) is fine for checking for primes, but if you need all of the divisors it's going to miss lots.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Finding perfect numbers - by BillMcEnaney - Apr-02-2019, 11:22 PM
RE: Finding perfect numbers - by ichabod801 - Apr-03-2019, 01:30 AM
RE: Finding perfect numbers - by BillMcEnaney - Apr-03-2019, 02:04 AM
RE: Finding perfect numbers - by ichabod801 - Apr-03-2019, 03:07 AM
RE: Finding perfect numbers - by BillMcEnaney - Apr-03-2019, 05:15 AM
RE: Finding perfect numbers - by micseydel - Apr-04-2019, 03:44 AM
RE: Finding perfect numbers - by BillMcEnaney - Apr-04-2019, 04:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Are there errors in the code for my coin toss systems? Matlibplot is too perfect . Coolkat 0 423 Nov-13-2023, 11:54 AM
Last Post: Coolkat
  Perfect numbers Vidar567 2 1,958 Nov-23-2020, 10:29 PM
Last Post: Vidar567
  Runs perfect in Python but fails to print last statement when converted to .exe. Help sunil422 3 2,881 Aug-13-2020, 01:22 PM
Last Post: deanhystad
  Finding line numbers starting with certain string Sutsro 3 2,614 Jun-27-2020, 12:36 PM
Last Post: Yoriz
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,824 May-09-2019, 12:19 PM
Last Post: Pleiades
  Help with try and open 6.txt file and print as perfect or not Pleiades 13 5,357 Jan-03-2019, 10:14 PM
Last Post: Pleiades
  Finding prime numbers creslin_black 7 4,474 Jul-20-2018, 02:28 PM
Last Post: grjmmr
  Perfect Number formula in Python Question an Mersenne Numbers Pleiades 5 6,175 May-16-2018, 04:56 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020