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

Home > Numbers
Squares needing 2 digits only (Posted on 2018-10-21) Difficulty: 4 of 5
List all perfect square numbers over 1000, employing only 2 different decimal digits. Example: 88^2=7744 will be on your list.

Ignore trivial solutions like 1 or 4 or 9 followed by an even number of zeroes.

How far can you go?

Known largest solution is a 10-digit number 6,661,661,161.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
different language - same result | Comment 2 of 3 |

I tried to get past 18 digits (where integer*8 ran out) by making a "squaring' routine in software. By execution time proved intolerable. 

So here is the hardware square version...


rabbit-3:~ lord$ t30

 winner                    16                    4

 winner                    25                    5

 winner                    36                    6

 winner                    49                    7

 winner                    64                    8

 winner                    81                    9

 winner                   121                   11

 winner                   144                   12

 winner                   225                   15

 winner                   441                   21

 winner                   484                   22

 winner                   676                   26

 winner                  1444                   38

 winner                  7744                   88

 winner                 11881                  109

 winner                 29929                  173

 winner                 44944                  212

 winner                 55225                  235

 winner                 69696                  264

 winner               9696996                 3114

 winner            6661661161                81619

C^C             

rabbit-3:~ lord$ 

rabbit-3:~ lord$ 

rabbit-3:~ lord$ 

rabbit-3:~ lord$ more t30.f

        program testtt

        integer*8 i,dum,d,ten,n

        integer flag,dtime,list(2),ndig,num(18)

        ten=10

           do i = 4,999999999

           list(2)=-1

           dum=i*i

           ndig=1+log10(1.*dum)

           if(ndig.gt.18)stop

           d=dum

                do n=ndig-1,0,-1

                p=ten**n

                num(n+1)=dum/ten**n

                dum = dum - num(n+1)* ten**n

                enddo

           if(num(1).eq.0) go to 2

           list(1)=num(1)

              do 1 k=2,ndig

                if(list(2).eq.-1.and.num(k).ne.list(1))then

                list(2)=num(k)

                go to 1

                endif

                if(num(k).ne.list(1).and.num(k).ne.list(2))go to 2

1             enddo

           if(num(1).ne.0)print*,'winner ',d,i  

2          enddo

        end

Edited on October 23, 2018, 4:45 am
  Posted by Steven Lord on 2018-10-23 04:42:59

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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