Joris Vergeer

Just some software engineer with some skills

Menu
  • Home
Menu

Multiplicative persistence

Posted on March 21, 2019October 17, 2019 by joris

After watching this @numberphile video I wanted to give it a try.

Then I came up with this piece if python code to try to find a possible 12 iteration sequence.

def factors(nr):
    i = 2
    factors = []
    while i <= nr:
        if (nr % i) == 0:
            factors.append(i)
            nr = nr / i
        else:
            i = i + 1
    return factors

def per_internal(iteration, number, doPrint = False):
    if doPrint:
        print '{} {} {}'.format(iteration, number, factors(number))

    if len(str(number)) == 1:
        return iteration
    
    digits = [int(i) for i in str(number)]

    result = 1
    for digit in digits:
        result *= digit

    return per_internal(iteration + 1, result, doPrint)

def per(number, doPrint = False):
    return per_internal(0, number, doPrint)

for x in range(0, 54):
    for y in range(0, 54):
        for z in range (0, 54):
            candidate = 2**x * 3**y * 7**z
            iterations = per(candidate, False)
            if iterations >= 10:
                per(candidate, True)

Result:

0 937638166841712 [2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7]
1 438939648 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 7, 7]
2 4478976 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3]
3 338688 [2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 7, 7]
4 27648 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3]
5 2688 [2, 2, 2, 2, 2, 2, 2, 3, 7]
6 768 [2, 2, 2, 2, 2, 2, 2, 2, 3]
7 336 [2, 2, 2, 2, 3, 7]
8 54 [2, 3, 3, 3]
9 20 [2, 2, 5]
10 0 []

0 4996238671872 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7]
1 438939648 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 7, 7]
2 4478976 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3]
3 338688 [2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 7, 7]
4 27648 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3]
5 2688 [2, 2, 2, 2, 2, 2, 2, 3, 7]
6 768 [2, 2, 2, 2, 2, 2, 2, 2, 3]
7 336 [2, 2, 2, 2, 3, 7]
8 54 [2, 3, 3, 3]
9 20 [2, 2, 5]
10 0 []

Just put the prime factors after each other and you have your initial number.

You don’t have to search any further because 222222222222222222222222222222222222222222222222222222 is the first number that when each digit is multiplied is larger than the just found 937638166841712. You get 2^54 = 1,801439851×10¹⁶, which is larger.

Below this number, no numbers are found that create a 12 number sequence.

Sorry Matt,

11 is the max

Work

Currently working for CowManager B.V.

Also busy working for my own start-up.
RetailEntertainment B.V.:

  • MKB-Muziek
  • Zorgscherm
  • Zorgstand

 

Recent Posts

  • [ASP.net Core] Body based routing with custom MatcherPolicy
  • Let docker and ufw work nicely
  • I am going to Mars
  • Multiplicative persistence
  • Calculating prime numbers on all your cores

Recent Comments

    Archives

    • July 2020
    • November 2019
    • May 2019
    • March 2019

    Categories

    • Uncategorized

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    © 2021 Joris Vergeer | Powered by Minimalist Blog WordPress Theme