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

Home > Numbers
Split the Square (Posted on 2022-04-06) Difficulty: 3 of 5
The number 10000 can be split into 100 + 0 + 0 = 100, which is sqrt(10000).

That's rather banal, but there are two other such 5-digit numbers.

One is 55225:

5 + 5 + 225 = 235 = sqrt(55225)

What is the other one?

Each digit must be used exactly once, in proper order.

Bonus:

How many such 6-digit squares can you find?

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

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution | Comment 1 of 4
Part 1:  
88209 [88, 209] 297
88 + 209 = 297 and 297^2 = 88209

Bonus:  
136161 [1, 361, 6, 1] 369
136900 [1, 369, 0] 370
136900 [1, 369, 0, 0] 370
143641 [14, 364, 1] 379
171396 [17, 1, 396] 414
431649 [4, 3, 1, 649] 657
455625 [45, 5, 625] 675
494209 [494, 209] 703
571536 [5, 715, 36] 756
627264 [62, 726, 4] 792
826281 [826, 2, 81] 909
842724 [842, 72, 4] 918
893025 [8, 930, 2, 5] 945
929296 [929, 29, 6] 964
980100 [980, 10, 0] 990
982081 [982, 8, 1] 991
982081 [982, 0, 8, 1] 991
998001 [998, 1] 999
998001 [998, 0, 1] 999
998001 [998, 0, 1] 999
998001 [998, 0, 0, 1] 999

There are 21  6-digit solutions, some of which can be split more than one way.
There are 16 unique 6-digit squares.

The numbers which show more than one solution simply have more than one way of
splitting due to double zeros being part of the number.   Also, there is only
one each for 1, 2, and 3-digit numbers:  1, 81, and 100 respectively.

There is an interesting 4-digit solution,
8281 [82, 8, 1] 91
8281 [8, 2, 81] 91
which has 2 different solutions which does not rely on the somewhat trivial
finding of different solutions solely because of well-placed zeros.

-----  Python code  -----

def split(n):
    """ input a positive integer, output list of all possible splits where
    each split is a list of integers formed by concatenating groups of
    digits between the splits """

    sn = str(n)
    d = len(sn)
    template = [bin(i)[2:] for i in range(2**(d-1))]
    for i,t in enumerate(template):
        template[i] = '0'*(d-1-len(t)) + template[i]
    splits_n = []
    sp_map = []
    for i,t in enumerate(template):
        sp_index = []
        sp_index.append(1)
        for c in t:
            if c == '0':
                sp_index[-1] += 1
            elif c == '1':
                sp_index.append(1)
        sp_map.append(sp_index)
    for i,t in enumerate(sp_map):
        templist = []
        cumul1 = 0
        cumul2 = 0
        for m in t:
            cumul2 += m
            templist.append(int(sn[cumul1:cumul2]))
            cumul1 += m
        splits_n.append(templist)
    return splits_n

six_digit_squares = []
power = 5
for n in range(10**power,10**(power+1)):
    for s in split(n):
        if sum(s)**2 == n:
            print(n, s, sum(s))
            six_digit_squares.append(n)

print('There are', len((six_digit_squares)), ' 6-digit solutions, some of which can be split more than one way.')
print('There are', len(set(six_digit_squares)), 'unique 6-digit squares.')

  Posted by Larry on 2022-04-06 08:24:12
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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