All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Number Difference and Erasure Puzzle (Posted on 2015-09-14) Difficulty: 2 of 5
The numbers 1, 3, 32, 33,...,310 are written on a blackboard.
We are allowed to erase any two numbers and write their difference instead (this is always a nonnegative integer.)
After this procedure has been repeated ten times, only a single number will remain.
What values could this number have?

See The Solution Submitted by K Sengupta    
Rating: 4.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: Too many to list Comment 3 of 3 |
(In reply to Too many to list by Jer)

Jer was right. 
Below is a recursive program which solves the problem.  It gave the exact values as in Jer's solution.

I then ran the program for all length sequences up to 3^10 and compiled a list of the smallest and largest values.  It turns out both sequences are in Sloane's at oeis.org
The smallest is A007051   a(n) = (3^n + 1)/2
The largest is A060816    a(0) = 1; a(n) = (5*3^(n-1) - 1)/2 for n > 0

The list for different lengths of sequences is
n;all;unique;smallest;largest
0 1 1 1 1
1 1 1 2 2
2 2 2 5 7
3 6 4 14 22
4 24 8 41 67
5 120 16 122 202
6 720 32 365 607
7 5040 64 1094 1822
8 40320 128 3281 5467
9 362880 256 9842 16402
10 3628800 512 29525 49207


answer_list = []
def crunch(aList):
    global answer_list
    if len(aList) == 1:
        return answer_list.append(aList[0])
    elif len(aList) == 2:
        return answer_list.append(abs(aList[1] - aList[0]))
    elif len(aList) > 2:
        for index, element in enumerate(aList[1:]):
            copy = aList[:]
            copy[index] = abs(copy[index] - copy[index-1])
            copy.pop(index-1)
            crunch(copy)
           
data = [1,3,3**2,3**3,3**4,3**5,3**6,3**7,3**8,3**9,3**10]
crunch(data)
print('the count is ', len(answer_list),' of which ',len(set(answer_list)),' are unique'
      ,'\n',answer_list,'\n',sorted(list(set(answer_list))))
  Posted by Larry on 2020-10-13 18:59:40

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information