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

Home > Numbers
Add 1, get a square II (Posted on 2009-04-26) Difficulty: 2 of 5
By adding 1 to the positive base N integer having the form XXXYYY with non leading zeroes, we get a perfect square- where X and Y are not necessarily distinct.

What are the value(s) of N, with 2 ≤ N ≤ 16, for which this is possible?

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.)
Some Thoughts Computer solution Comment 3 of 3 |
Since it is true for every base b number where all 6 digits of n are (b-1), omit those where X and Y are the same. 

I took it from base 2 to base 36:
base  N   N+1   square root
5 111333 3969 63
9 222666 133225 365
10 111555 111556 334
10 444888 444889 667
13 333999 1207801 1099
16 555888 5593225 2365
17 111777 1510441 1229
17 444CCC 6036849 2457
17 999FFF 13579225 3685
19 222AAA 5230369 2287
19 888GGG 20912329 4573
21 555FFF 21446161 4631
25 666III 61042969 7813
25 DDDOOO 132250000 11500
26 111999 12362256 3516
26 444GGG 49434961 7031
26 999LLL 111218116 10546
26 GGGOOO 197711721 14061
28 333FFF 53553124 7318
28 CCCOOO 214183225 14635
29 777LLL 148718025 12195
32 111VVV 34668544 5888
33 222EEE 80730225 8985
33 888OOO 322884961 17969
33 IIIUUU 726464209 26953 

-----
convertString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
from itertools import combinations
from itertools import permutations

bigbase = 36
squares = [a*a for a in range(8, bigbase**3 + 1)]

for base in range(2,bigbase+1):
    digits = convertString[:base]
    duo = []
    ns = []
    for comb in combinations(digits, 2):
        if comb[0] == comb[1]:
            if comb[0] == '0':
                continue
            duo.append(comb)
            ns.append(comb[0]*3 + comb[1]*3)
        else:
            for perm in permutations(comb):
                if perm[0] == '0':
                    continue
                duo.append(perm)
                ns.append(perm[0]*3 + perm[1]*3)
    for txtnum in ns:
        x = 1 + int(base2base(txtnum, base, 10))
        if x in squares:
            print(base, txtnum, x, int(x**.5))

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