SlideServe
Menu
Préférences
© SlideServe · v2026

Project 2

teagan avatar
6 diapositives · 187 Views · Jul 26, 2014

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 :

Project 2 - slide 1
01 / 6Project 2
1 / 17

Télécharger la présentation

Project 2
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  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).