Python Forum
Program that displays the number with the greatest amount of factors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program that displays the number with the greatest amount of factors
#2
Hello! You could simply add a variable which stores the current number with most factors.
On next iteration, if new number has same or more factors than previous "most factors" one, assign new number to the "most factors" variable. That way you don't even need to worry about the highest number, if there are more with same (highest) number of factors.
It will take some rearranging of your code, but you pretty much have all you need already coded.
Reply


Messages In This Thread
RE: Program that displays the number with the greatest amount of factors - by j.crater - Nov-01-2018, 04:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Program to check whether a number is palindrome or not PythonBoy 18 3,126 Sep-12-2023, 09:27 AM
Last Post: PythonBoy
  Python Program to Find the Factorial of a Number elisahill 2 1,525 Nov-21-2022, 02:25 PM
Last Post: DeaD_EyE
  Program that allows to accept only 10 integers but loops if an odd number was entered gachicardo 4 3,781 Feb-24-2022, 10:40 AM
Last Post: perfringo
  Python prediction on historical data and/or external factors. pyrooky 1 1,768 Sep-03-2020, 03:19 PM
Last Post: DPaul
  Print the frequency of each coin for the combinations that sum to the amount N Pranav 3 2,630 May-19-2020, 06:16 AM
Last Post: Pranav
  traverses directory recursively and displays files Prani05 7 3,500 Apr-30-2020, 10:25 AM
Last Post: snippsat
  Unexpected change to a list in a small amount of self-contained code Johno 5 2,968 Mar-15-2020, 05:06 PM
Last Post: jefsummers
  Factors ERROR AdamJae 2 2,046 Oct-22-2019, 05:58 PM
Last Post: AdamJae
  Python Finding Prime Factors foxman322 1 2,372 Jan-11-2019, 04:33 PM
Last Post: ichabod801
  Creating a variable that displays time groovydingo 3 2,986 Apr-17-2018, 04:46 AM
Last Post: tannishpage

Forum Jump:

User Panel Messages

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