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

Home > Numbers
Concatenation equals Sum of Squares (Posted on 2020-12-01) Difficulty: 3 of 5
Two positive integers, a and b, are of 4 digits or less.

For what (a,b) pairs is it true that the sum of their squares is equal to their concatenation?

No Solution Yet Submitted by Larry    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: soln | Comment 2 of 5 |
(In reply to soln by Steven Lord)

It's not always 10,000 that you need to multiply by; it could be a smaller power of ten for shorter second numbers, to do a concatenation.


for a=1:9999
    f=10;
    for b=1:9999
        if b==10 || b==100 || b==1000
            f=f*10;
        end
        c=f*a+b;
        if c==a^2+b^2
            disp([a b a^2 b^2 c])
        end
    end
end

      a           b         a^2         b^2     a^2+b^2
     10           1         100           1         101
    10         100         100       10000       10100
    12          33         144        1089        1233
    88          33        7744        1089        8833
   588        2353      345744     5536609     5882353
   990         100      980100       10000      990100
  9412        2353    88585744     5536609    94122353

  Posted by Charlie on 2020-12-01 12:48:00
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 (0)
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