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

Home > Numbers
Ingenious Sum Puzzle 2 (Posted on 2023-07-01) Difficulty: 3 of 5
(A)Consider the set of all possible positive quaternary (base 4) integers each having exactly twelve digits consisting of precisely three 1's, three 2's, three 3's and three 0's. The first digit cannot be 0. Determine the sum of all these numbers in the decimal notation.

(B)Consider the set of all possible positive quinary (base 5) positive integers each having exactly fifteen digits consisting of precisely three 1's, three 2's, three 3's, three 4's, and three 0's. The first digit cannot be 0. Determine the sum of all these numbers in the base ten (decimal) notation.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution A and B, analytic backed by program Comment 2 of 2 |
A: 2889036460800
B: 2456066894465184000

First practice on a smaller problem, verify with a program to make sure the logic is correct.
start with [0,0,1,1,2,2,3,3]; 8 digits
avg 1st digit is 2, avg other digits are all 10/7  (remove a 2 from set of integers)
Total number by computer progra is 1890
Sums of each digit individually, by program is:
[3780, 2700, 2700, 2700, 2700, 2700, 2700, 2700]
how to get 1890?
3 ways to have first digit.  Then you have 7 more to allocate from groups of 2,2,2, and 1
3*7!/(2!2!2!1!)
The average 8 digit number is 2*4^7 + (16/11)*sum of powers of 4 from zero to 6
4^7 is 16384
sum 4^0 + ... + 4^6 = (4^7 - 1)/(4-1) = 5461
(2*16384 + (10/7)*5461) * 1890 = 76676220
print out from program .....              76676220   it checks

(A)  The average of the first digit is 2.
The average of any other digit is sum([0,0,0,1,1,1,2,2,3,3,3])/11
The average 12 digit number is 2*4^11 + (16/11)*sum of powers of 4 from zero to 10
2*4^11 + (16/11)* (4^11 - 1)/(4 - 1)
2*4194304 + (16/11)*1398101   is the average 12 digit number

How many of them are there?
The start with either 1,2, or 3, so there are 3 ways for the first digit
Then you have 11 more to allocate from groups of 3,3,3, and 2
3*11!/(3!3!3!2!)
3 * 39916800 / 432 = 277200 different 12 digit numbers.

So the total sum is 
(2*4194304 + (16/11)*1398101 ) * 277200 = 2889036460800

(B)  The average of the first digit is 2.5
The average of any other digit is
  the sum of all digits (30) minus 2.5 is 27.5; there are 14 more digits.
So the average "non first" digit is 27.5/14
The average 12 digit number is 2.5*5^14 + (27.5/14)*sum of powers of 5 from zero to 13
2.5*5^14 + (27.5/14) * (5^14 - 1)/(5 - 1)
2.5 * 6103515625 + (27.5/14)*1525878906   is the average 15 digit number

How many of them are there?
The start with either 1,2,3, or 4, so there are 4 ways for the first digit
Then you have 14 more to allocate from groups of 3,3,3,3, and 2
4*14!/(3!3!3!3!2!)
4 * 87178291200 / 2592 = 134534400 different 15 digit numbers.

So the total sum is 
( 2.5 * 6103515625 + (27.5/14)*1525878906 ) * 134534400 = 2456066894465184000

----  code below is for my "practice" version ----
from itertools import permutations
count = 0

allofthem = []
placesums = [0 for i in range(8)]
for perm in permutations([0,0,1,1,2,2,3,3]):
    if perm[0] == 0:
        continue
    if perm in allofthem:
        continue
    allofthem.append(perm)
    for i,v in enumerate(perm):
        placesums[i] += v
    count += 1
    
    # print(perm)
print(count)
print(placesums)

runningsum = 0
for a in allofthem:
    x = ''.join([str(d) for d in a])
    runningsum += base2base(x, 4, 10)
print('runningsum is ', runningsum)

ccount = 0
for i in range(7):
    ccount += 4**i
print(ccount)

  Posted by Larry on 2023-07-01 12:29:52
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (5)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (10)
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