Numbers whose squares start with 4 identical digits, with 5, with 6...

Jonathan Post jvospost3 at gmail.com
Thu Aug 30 03:16:49 CEST 2007


Numbers whose squares start with 7 identical digits.

In[9]:= Select[Range[1000, 5000000],
          Length[Union[Take[IntegerDigits[#^2], 7]]] == 1 &]

Out[9]= {745356, 942809, 1490712, 1825742, 3333334, 4714045, 4714046}

Example:

745356^2 = 555555566736



Jonathan Post wrote:

> Numbers whose squares start with 7 identical digits.
>
> In[9]:= Select[Range[1000, 5000000],
>           Length[Union[Take[IntegerDigits[#^2], 7]]] == 1 &]
>
> Out[9]= {745356, 942809, 1490712, 1825742, 3333334, 4714045, 4714046}
>
> Example:
>
> 745356^2 = 555555566736

Here's an example of a more generic Mathematica program that  
calculates the first q terms of squares starting with n identical  
digits:

In[1]:=

n = 17; q = 10; t =
Table[{(10^n - 1)*i/9, (10^n - 1)*i/9 + 1}, {i, 1, 9}]; t =
Sqrt[Union[t, 10*t]]; k = 1; While[
k}]]];
Length[s] < q, k++]; Take[s, q]

Out[1]:=

{7453559924999299, 10540925533894598, 14907119849998598,  
33333333333333334, 47140452079103169, 57735026918962577,  
66666666666666667, 74535599249992990, 81649658092772603,  
88191710368819686}

In[2]:=

%^2

Out[2]:=

{55555555555555555733985150491401, 111111111111111115889741773581604,  
222222222222222222935940601965604,  
1111111111111111155555555555555556,  
2222222222222222288842087345842561,  
3333333333333333396736221926480929,  
4444444444444444488888888888888889,  
5555555555555555573398515049140100,  
6666666666666666622046303867395609, 7777777777777777716034080781138596}

It's a quick hack so I apologize if there's something wrong with it.  
I'm not totally happy with the 10^-1000 fudge-factor: it's just meant  
to reduce the number that it's part of by one, if it should ever turn  
out to be an exact integer.

Hans







More information about the SeqFan mailing list