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

Home > Numbers
Cube + Single Digit = Perfect Square (Posted on 2024-01-21) Difficulty: 3 of 5
Which is the highest cube n^3 < 108 that can be incremented by a single digit from 1 to 9 to yield a perfect square?

For example, 8 is a perfect cube. When incremented by 1 it becomes 81, which is a perfect square.

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 Computer solution Comment 2 of 2 |
When this problem was first in the queue, it was unclear whether the word 'incremented' was meant to convey (1) addition or (2) concatenation.  The example makes it clear that what is meant is the latter.

I found results for both meanings, program output:
Interpretation (1) Addition
1 3 4 2
1 8 9 3
8 1 9 3
8 8 16 4
27 9 36 6
216 9 225 15
64000 9 64009 253
97336 8 97344 312

Interpretation (2) Concatenation
1 6 16 4
8 1 81 9
18821096 1 188210961 13719

-----------------------
solutions1 = []
solutions2 = []
cubes = [n**3 for n in range(1,10**4)]

print('Interpretation (1) Addition')
for c in cubes:
    for d in range(1,10):
        if issquare(c+d):
            print(c,d,c+d,int((c+d)**.5))
            solutions1.append([c,d,c+d,int((c+d)**.5)])

print()

print('Interpretation (2) Concatenation')
for c in cubes:
    for d in range(1,10):
        incr = int(str(c) + str(d))
        if issquare(incr):
            print(c,d,incr,int((incr)**.5))
            solutions2.append([c,d,incr,int((incr)**.5)])

  Posted by Larry on 2024-01-21 13:21:12
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