1 / 6

Project 2

Project 2. Primary X- Subfactor Series. Factors. 6 {1, 2, 3, 6} 25 {1, 5, 25} 48 {1, 2, 3, 4, 6, 8, 12, 16, 24, 48} How do you tell if x is a factor of y ? (python) if y % x == 0: An inefficient way to get all the factors of y :

teagan
Download Presentation

Project 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project 2 Primary X-Subfactor Series

  2. Factors • 6 {1, 2, 3, 6} • 25 {1, 5, 25} • 48 {1, 2, 3, 4, 6, 8, 12, 16, 24, 48} • How do you tell if x is a factor of y? • (python) if y % x == 0: • An inefficient way to get all the factors of y: • (python) filter(lambda x: y % x == 0, range(1, y+1))

  3. Subsequences • Discard one or more digits, then leading zeros. • 1234: {123, 124, 134, 234, 12, 13, 14, 23, 24, 34, 1, 2, 3, 4} • 2004: {200, 204, 20, 24, 2, 4} • 7: {7} • How do you generate a list of all the subsequences of a number?

  4. Subfactors • If a number x > 1 is both a factor of y and a subsequence of y, then it is a subfactor of y. • The only subfactor of 1234 is 2. • 6341 has none • 8013824 has {2, 4, 8, 13, 14, 32, 182, 832} • Once you’ve generated a list of subsequences, you can filter that list for factors, which gives you a list of subfactors.

  5. X-Subfactor series • Start with a number. • Find a subfactor. • Produce a new number by x-ing (discarding) the digits of the subfactor from the original number. • Continue this process until you reach a number with no subfactors. • 25 2 • 48 8 • 48 4 • 111111 111 • 111111 1111 11

  6. Assignment • For a given number n, find the primary x-subfactor series. • Primary means either the series with the most numbers, or if there is a tie, the one with the smallest second number (ties continue to be broken by comparing the next number and taking the smallest).

More Related