20070604, 17:57  #1 
May 2004
New York City
3·17·83 Posts 
Find a Square
Find a positive integral square whose (decimal) digit representation
ends in the pattern ABABABABAB. Is it possible to have a square end in a longer repeated pattern? 
20070604, 18:00  #2 
Jun 2003
The Texas Hill Country
10001000001_{2} Posts 
For A=B=0, it is trivial.

20070604, 18:03  #3 
Jan 2005
Transdniestr
111110111_{2} Posts 
Davar, I assume A and B have to differ. Right?
Last fiddled with by grandpascorpion on 20070604 at 18:04 
20070604, 18:15  #4 
May 2004
New York City
3·17·83 Posts 
Yes, the number must end in ABABABABAB with A and B distinct.
There is more than one solution, so perhaps find the smallest. Last fiddled with by davar55 on 20070604 at 18:17 
20070604, 19:22  #5 
Jan 2005
Transdniestr
503 Posts 
Found with the help of Excel, probably not the smallest. My solution is around 4.4 billion and change
4491146011^2 = 20170392492121212121 Yeah, there's an infinite number of solutions. a*10^10 + (any solution under 10^10) where a is an integer >= 1 will give you a different solution. Last fiddled with by grandpascorpion on 20070604 at 19:33 
20070604, 20:21  #6 
May 2004
New York City
1089_{16} Posts 
Perfectly good solution, though not the smallest.
And yes there are an infinite number of solutions. Another that you didn't mention is four times yours (double the square root) since that square ends in 8484848484. 
20070604, 20:56  #7 
Jan 2005
Transdniestr
503 Posts 
Quite true

20070604, 21:24  #8 
Feb 2007
2^{4}·3^{3} Posts 
smallest
162459327
found in 9 min by PARI script (KISS principle, could be improved in roughly as many ways as there are characters in...) {zz=10^8;for(x=2*10^6,10^10,if((tt=divrem(x^2%zz,10000))[1]!=tt[2],next); if(!tt(tt=divrem(tt[1],100))[1]!=tt[2],next); print([x,tt[2]=x^2%10^10]);if(tt[1]==tt[2]\zz,break))} 
20070604, 21:41  #9 
Feb 2007
2^{4}×3^{3} Posts 
Theorem
If x^2 = x^2\10^4 (mod 10^4) and x^2 = x^2\100 (mod 100),
then x^2 = 0,64,21,84,69,29 or 61 mod 100. (where \ means truncated integer division) The proof of this theorem exists, even if I don't know it since I don't look for it... (and anyway, one cannot write into the margins of this forum...) Last fiddled with by m_f_h on 20070604 at 21:44 
20070604, 21:58  #10 
May 2004
New York City
1000010001001_{2} Posts 
Yes I think that's the smallest!
My source gave 508853989[sup]2[/sup] = 258932382121212121 which is larger! Since your solution 162459327[sup]2[/sup] = 26,393,032,929,292,929 ends in 2929292929, we now have solutions that end in ABABABABAB with AB = 21, 29, and 84. According to my source, there are two more possible ending values of AB besides 00. (You listed three: 61,64,69.) Can you find solutions for these values too? (I don't have their smallest solutions at hand.) Last fiddled with by davar55 on 20070604 at 22:09 Reason: fix spoilers 
20070604, 22:45  #11  
Feb 2007
2^{4}×3^{3} Posts 
Quote:
PS: 1/ hey guys, I have 2 or 3 other things (less funny but more required) to do... 2/ note my Thm speaks about mod 10^8 not mod 10^10 but adding the same thing with a sufficiently large multiple of 100...001 should do the job, no ? 3/ you should optimize my script, maybe by using Mod(,10^10) and adding 2n+1 to go to the next square, instead of doing x^2%10^8 each time. (check if it's really faster, I had some counterintuitive surprises regarding similar pbs...) I don't have time for more than this quick hack, today :( ! (besides the fact that my box has 2 mprimes running and a dozen of other active windows with a dozen of tabs in each, including gmail with its CPU intensive scripts... Last fiddled with by m_f_h on 20070604 at 22:57 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Where can I find a Reverse and Add program? I can't find any!  Stargate38  Programming  18  20150710 06:08 
Perfect square or not?  jnml  Puzzles  12  20120428 21:33 
red square  Fusion_power  Puzzles  14  20080425 11:37 
How often is 2^p1 squarefree  ZetaFlux  Math  16  20051214 06:55 
Fast way to square???  maheshexp  Math  2  20040529 01:54 