## Crafting grafting, part 4

(I’ve gone back and revised my notation. $a$ becomes $j$ and $b$ becomes $10^m$.)

Check out this grafting number, the second biggest I’ve got at the moment:

$\sqrt{8578201027979935320056}=92618578201.027979935320056863...$

There’s some structure to understand here. This is generated using $j = 9261$, $m = 8$, and $n = 7$. You can read those values off the numbers above, though. There are 22 digits in the integer on the left, and that’s $2n+m$. On the right, those 22 digits recur starting 7 digits left of the decimal point; that’s $n$. Before them are the digits $9261$, which is $j$.

Likewise, examine this one:

$\sqrt{4110105646} = 64110.105646457...$

You can see $2n+m = 10$ and $n = 4$, so $m = 2$, and $j = 6$.

Though here’s an evil one:

$\sqrt{576276646} = 24005.76276646922...$

Here $2n+m = 9$ and $n = 1$, so $m = 7$, and $j = 2400$. Or… wait, is it? If you write the integer on the left as $0576276646$ then $2n+m = 10$ and $n = 2$ so $m = 6$ and $j = 240$. Or should you write it as $00576276646$ and conclude $2n+m = 11$ and $n = 3$ so $m = 5$ and $j = 24$? Turns out all three interpretations are valid; they lead to three different equations yielding the same grafting number.

$\sqrt{100} = 10.000...$

Well, $2n+m = 3$ and $n = 2$, so $m =$, um, $-1$? And $j = 0$? Those give $x = 0.1000...$ (with the $+$ sign in the quadratic formula, unlike all normal grafting numbers, because the $-$ sign gives $x=0$) and the equation $10^2(0+0.1) = \sqrt{10^4(10^{-1}(0.1))}$ or $10 = \sqrt{100}$. Yes, that sort of fits the profile, but in an ugly way.

Likewise, $\sqrt{98} = 9.8995...$ and $\sqrt{99} = 9.9498...$ have similarly pathological analyses. Those I think really do need to be counted as grafting numbers, but not normal ones.

Two things I have not figured out yet is why it’s always the ceiling, not the floor, that gives the grafting number, and why $j = 2$ and $m = 1$ gives grafting numbers for, apparently, all values of $n$ while other values of $j$ and $m$ don’t. I suspect these are related. Observe

$\sqrt{\lceil y \rceil} = \sqrt{y-\{y\}+1} = \sqrt{y}\sqrt{1-\frac{\{y\}-1}{y}}$

(with braces denoting fractional part) which is, to first order

$\sqrt{y}\left (1-\frac{\{y\}-1}{2y} \right ) = \sqrt{y} - \frac{\{y\}-1}{2\sqrt{y}}$

and $\{y\}$ is whatever it is, but it’s in $0<\{y\}<1$ and for an approximate result we can take $\{y\}\approx1/2$ so

$\sqrt{\lceil y \rceil} \approx \sqrt{y} + \frac{1}{4\sqrt{y}}$.

By taking the square root of the ceiling of a number $y$ instead of $y$ itself, we add approximately $1/(4\sqrt{y})$ to the square root. By the same token, using floor subtracts about $1/(4\sqrt{y})$.

That’s sort of an average, though, and in the case of grafting numbers, it’s often an overestimate. For instance, for $n = 3$, $j = 8079$, we get $x=49991903-\sqrt{2499190300000000}=6557202816420999992418...$. Then with $m = 8$ we end up with grafting number $\lceil 65572028164209.99992418... \rceil$. Clearly the ceiling in this case changes the number by several orders of magnitude less than $\approx 1/2$. But why don’t numbers looking hypothetically like $\lfloor 65572028164209.00002418... \rfloor$ work out?

## Crafting grafting, part 3

In the first two parts we found some grafting numbers using the equation $(j+x)^2=10x$ with $j=1~{\mathrm or~}2$. Real solutions $0 < x < 1$ can be turned into integer grafting number candidates $\lceil 10^{2n+1}x\rceil$. Or potentially $\lfloor 10^{2n+1}x\rfloor$ but we haven’t found a case where that works.

We could use other values for the coefficient of $x$, though. Any power of 10 in fact. (For grafting numbers in base 10. If you want grafting numbers in another base, use powers of that base.) We have $(j+x)^2=10^mx$. Solutions are $x = ((10^m-2j)\pm\sqrt{10^{2m}-4\times 10^mj})/2$. Real solutions are obtained up to $j=10^m/4$ but we want $0 < x < 1$. You can figure out this means $j < \sqrt{10^m}-1$.

For instance, with $m=2$, we can use $0 < j < 9$. With $j=1$, $x = 0.0102051443...$. Now $\lceil 10^{2n}(100x)\rceil$ = 2 ($n=0$), 103, 10206, 1020515, 102051444… not one of which, sorry to report, is a grafting number. With $j=8$, though, and $n = 0$, we get $\sqrt{77} = 8.77496...$ and that is a grafting number, though not very impressive. $j=6$ and $n = 4$ gives us $\sqrt{4110105646} = 64110.105646457...$. Yes! That’s what I’m talking about! And $j=7$ with $n = 1, 3, 5$ gives $\sqrt{5736} = 75.73638...$, $\sqrt{57359313} = 7573.5931366...$, and $\sqrt{57359312880715} = 7573593.1288071582...$.

And on it goes. Those two I started off the first post with, 60,755,907 and 63,826,090,875, arise from $j=7794$, $m=8$, and $n=0$ and $j=252$, $m=5$, and $n=3$, respectively. Here’s another: $\sqrt{44144658239614} = 6644144.658239614216...$, and that’s the only one I’ve found so far using floor instead of ceil. Edit: This does not use floor; I must have been fooled by a rounding error. This comes from $j=66$, $m=4$, and $n=5$. Then $x = 0.4414465823961399708...$, and $10^{14}x = 44144658239614$ when rounded up. In fact I’ve found no cases where floor gives the grafting number, and exactly one case where both ceil and 1+ceil work: $j=2$, $m=1$, and $n=1$ giving grafting numbers 764 and 765. Otherwise it’s always ceil. Which suggests other questions to ask. Sometime.

## Crafting grafting, part 2

Before going on, let me address an omission. I gave some examples of grafting numbers but I never actually specified what a grafting number is.

A grafting number is a counting number whose digits appear (consecutively, and in order) in its square root, starting at or to the left of the decimal point.

Matt Parker excludes cases where the digits appear further to the right of the decimal point, which may seem an arbitrary restriction, but it makes sense if you think about it. We don’t know that square roots of nonsquare counting numbers are normal numbers, but it does seem plausible. A normal number is an irrational number in which every finite string of digits occurs with equal density to every other digit string of the same length. If square roots are normal then including numbers whose digits appear anywhere in their square root as grafting numbers would mean every nonsquare number is a grafting number! For instance:

$\sqrt{744} = 27.27636339397171178551719510385918447020016888957751385958655644587745126\mathbf{744}79307476086...$

That would be a bore, so we just allow numbers whose digits appear beginning at or to the left of the decimal point in their square roots.

The above definition allows $\sqrt{1} = 1$ and $\sqrt{100} = 10.0$, for instance, and it probably shouldn’t, but let’s leave it as is for now.

We came up with a grafting number by first finding $\sqrt {10(3-\sqrt{5})} = \sqrt{7.639320...}=2.7639320...$, then multiplying both sides by 100, and then rounding up the number under the radical sign to an integer.

100 was an arbitrary choice, though. What if we used $10^n$? That is, candidate grafting numbers would be $\sqrt{\lceil 10^{2n}\times 7.639320... \rceil}$.

Let’s check:

• $\sqrt{8} = 2.828...$
• $\sqrt{764} = 27.6405...$
• $\sqrt{76394} = 276.39464...$
• $\sqrt{7639321} = 2763.932162...$
• $\sqrt{763932023} = 27639.3202340...$

Seems to work every time. Notice the floor function doesn’t work, though: $\sqrt{763932022} = 27639.3202159...$ doesn’t match that last digit, for instance. It’s not obvious why the ceiling function works and the floor function doesn’t. One might think both could work, or floor but not ceiling, or neither. For that matter there’s the… superceil? The second integer higher? That works in one case: $\sqrt{765} = 27.6586...$. There’s stuff to dig into here. But let’s set it aside.

We have here a series of grafting numbers, none of which is 60755907 or 63826090875 so clearly there’s more exploration to be done.

We got the above by considering $(j+x)^2=10x$, where $j=2$. What about other values of $j$, though? Expanding gives $x^2-(b-2j)x+a^2 = 0$ and so $x = ((b-2j)\pm\sqrt{b^2-4jb})/2$. Then when $j=1$ one solution is $4-\sqrt{15}=0.1270166538...$. (We want solutions in $0 < x < 1$, so the other solution is discarded.)

So $\sqrt{1.270166538...} = 1.1270166538...$ which looks promising. Let’s check:

• $\sqrt{2} = 1.414...$ — nope.
• $\sqrt{128} = 11.3237...$ — nope.
• $\sqrt{12702} = 112.70314...$ — nope.
• $\sqrt{1270167} = 1127.016858....$ — nope.
• $\sqrt{127016654} = 11270.1665471...$ — finally!

And no, the floor function doesn’t work where the ceiling fails here (or where it succeeds). Looks like we have a way of generating candidate grafting numbers, but not necessarily good ones.

That was $j=1$ and $j=2$. For $j=3$, $10^2-40j < 0$ and there are no real solutions. So that’s that.

Except we can vary the right hand side of $(j+x)^2=10x$. The coefficient of $x$ can be any power of 10: $(j+x)^2=10^mx$. We’ll do that next time.

The grafting numbers less than a million (excluding the dubious 1, 100, and 10000) are:

nsqrt(n)
82.8284…
778.77496…
989.8994…
999.9498…
76427.64054…
76527.65863…
571175.5711585…
573675.736384…
979798.9797959…
999899.98999…
999999.99499…
76394276.394645…
997997998.997997995…
999998999.998999…
999999999.999499…

## Crafting grafting

Here’s a cool integer: 60,755,907. What’s cool about it? Take the square root. You’ll need more significant figures than usual; the calculator that came with my Android phone will do it:

$\displaystyle \sqrt{60755907} = 7794.6075590756973...$

Check out what’s to the right of the decimal point. Crazy, right? Here’s another similar number:

$\displaystyle \sqrt{63826090875} = 252638.2609087546739...$

Here the digits of the integer on the left appear in the real number on the right starting in the 100s place. Matt Parker calls these things “grafting numbers“. What’s going on with them? This isn’t just weird coincidence, is it?

It isn’t.

Consider good old $\phi = (1+\sqrt{5})/2$. It’s a solution of the equation $x^2=x+1$. So $\phi = 1.6180339...$ and $\phi^2 = 2.6180339...$. There a number and its square (or, looked at the other way, a number and its square root) have digits in common; an infinite number of them, in fact. There’s a hint here.

Now let’s look at solutions to $(j+x)^2 = 10x$. Suppose $0 < x < 1$. Now if $j$ is an integer, then $j+x$ in decimal form is just the concatenation of $j$ and $x$ and $10x$ is just the digits of $x$ shifted one to the left.

For instance, $j = 2$; then $(2+x)^2 = 10x$. One solution is $3-\sqrt{5} = 0.7639320...$, and $2.7639320...^2 = 7.639320...$. Or looked at another way, $\sqrt{7.639320...}=2.7639320...$.

This starts to look like the grafting numbers idea, but grafting numbers are integers. But hang on. Multiply both sides by, say, 100: $\sqrt{76393.20...} = 276.39320...$. Round the number on the left up and you find

$\displaystyle \sqrt{76394} = 276.394645...$

There you go, a grafting number. How about more? We’ll see…

## Three rectangles

Catriona Shearer posted this problem to Twitter and it got a lot of discussion, so I thought I’d post my solution here in more detail than Twitter permits.

This design is made of three 2×1 rectangles. What fraction of it is shaded?

Label vertices and draw in a couple line segments:

Considering triangles CFJ and CKJ, angles CFJ and CKJ are right, line segment CJ is common, and CF = CK = 2, so the two triangles are congruent and FJ = JK = 1. But then angles CGE and JGK are equal, angles CEG and GKJ are right, and CE = JK, so those triangles are congruent and CG = GJ.

So JK = 1, and if KG = x, GJ = CG = 2-x, so 1²+x² = (2-x)². The solution is x = 3/4. The area of each shaded triangle is 3/8. The area of the whole pattern is three rectangles minus the shaded area: 6-3/4 = 21/5. The shaded area is 1/7 of the area of the whole pattern.

Notice the shaded triangles are 3:4:5.

Can the shaded area be dissected into pieces, seven of each of which will fill the pattern? Yes.

Here are the relative sizes of the pieces, in case you’re interested:

• Blue: 9:12:15
• Green: 12:16:20
• Red: 9:25:30:38
• Magenta: 10:16:38:40
• Shaded triangles (blue+red and green+magenta): 30:40:50

## 2^n-gons

There’s nothing at all new about this, in fact it’s ancient, but maybe it’s new to you? So here goes.

Here’s a square inscribed in a unit circle:

Or to keep down the clutter, here’s just one quadrant of that:

One side of the square along with the radii at each endpoint forms a triangle. The length of one side of the square we’ll call $s_4$ and it is of course $\sqrt 2$. That means the perimeter of the square is $p_4 = 4\sqrt 2\approx 5.656854249$.

Now consider an inscribed octagon. Again, here’s just one quadrant.

One side of the square is labeled $s_8$; what’s its length? Well, drop a perpendicular from the vertex in the middle:

And now notice the right triangle with hypotenuse 1 and sides $x_8$ and $h_8$ is just half of a quadrant of an inscribed square, which means $h_8=s_4/2$. Then $x_8^2 = 1-h_8^2 = 1-s_4^2/4$. From that you can get $y_8=1-x_8$ and from that, $s_8^2=h_8^2+y_8^2$. The perimeter of the octagon is then $p_8 = 8s_8\approx 6.122934918$.

Well, that was so much fun, let’s do it again. Here’s a quadrant of a 16-gon:

The right triangle with hypotenuse 1 and sides $x_{16}$ and $h_{16}$ is just half of an eighth of an inscribed octagon, which means $h_{16}=s_8/2$. Then $x_{16}^2 = 1-h_{16}^2 = 1-s_8^2/4$, $y_{16}=1-x_{16}$, and $s_{16}^2=h_{16}^2+y_{16}^2$. The perimeter of the 16-gon is then $p_{16} = 16s_{16}\approx 6.242890305$.

You know the rest, right? From here you can do the 32-gon, 64-gon, 128-gon, and so on, getting $x_{2n}^2 = 1-h_{2n}^2 = 1-s_n^2/4$, $y_{2n}=1-x_{2n}$, $s_{2n}^2=h_{2n}^2+y_{2n}^2$, and perimeter $= p_{2n} = 2ns_{2n}$. For $n = 1024$, the perimeter is $p_{1024}\approx 6.283175451 = 2\times 3.1415877255$. As $n$ increases, the perimeter gets closer and closer to the circumference of the circle, so this gives a way to calculate $\pi$.

What about circumscribed polygons? If you look at the figures above, you can see the ratio of the size of a circumscribed square to an inscribed square is $1/x_8$. Likewise the ratio of the size of a circumscribed octagon to an inscribed octagon is $1/x_{16}$, and so on. So the perimeter of a circumscribed $n$-gon is $P_n = p_n/x_{2n}$. As $n$ increases, $P_n$ approaches $2\pi$ from above. And the average of $p_n$ and $P_n$ is a better approximation to $2\pi$ than either, though not by a lot.

 n h_n x_n y_n s_n p_n P_n average 4 1.41421356 5.65685425 8.00000000 6.82842712 8 0.70710678 0.70710678 0.29289322 0.76536686 6.12293492 6.62741700 6.37517596 16 0.38268343 0.92387953 0.07612047 0.39018064 6.24289030 6.36519576 6.30404303 32 0.19509032 0.98078528 0.01921472 0.19603428 6.27309698 6.30344981 6.28827340 64 0.09801714 0.99518473 0.00481527 0.09813535 6.28066231 6.28823677 6.28444954 128 0.04906767 0.99879546 0.00120454 0.04908246 6.28255450 6.28444726 6.28350088 256 0.02454123 0.99969882 0.00030118 0.02454308 6.28302760 6.28350074 6.28326417 512 0.01227154 0.99992470 0.00007530 0.01227177 6.28314588 6.28326416 6.28320502 1024 0.00613588 0.99998118 0.00001882 0.00613591 6.28317545 6.28320502 6.28319024

This is something like the way Archimedes calculated $\pi$ around 250 BC (I told you this was ancient), although he started with a hexagon rather than a square and only went up to a 96-gon. He didn’t have Google Sheets, though.

## Ancient ritual recovered, part 2

How does that method work? Say you have a number $x$ which can be written as $\sum_{i=0}^n 100^ix_i$, where the $x_i$ are positive integers less than 100, that is, they are pairs of digits in $x$. Start with $x_n$ and find the largest digit $a_n$ whose square is no greater than $x_n$, that is, $x_n=a_n^2+r_n$.

Now consider $100x_n+x_{n-1}$, that is, the number formed from the first two pairs of digits in $x$. Its square root is a little more than (or equal to) $10a_n+a_{n-1}$ where $a_{n-1}$ is the largest digit which, appended to $a_n$, gives you a number whose square is no greater than $100x_n+x_{n-1}$. That is, $100x_n+x_{n-1} = (10a_n+a_{n-1})^2+r_{n-1}$. But $(10a_n+a_{n-1})^2 = 100a_n^2+(20a_n+a_{n-1})a_{n-1}$ and so $100r_n+x_{n-1} = (20a_n+a_{n-1})a_{n-1}+r_{n-1}$. The number on the left is just the remainder from the previous step with the next pair of digits from $x$ appended, and the first term on the right is twice the result from the previous step with a new digit appended, multiplied by that new digit. Their difference gives our new remainder, $r_{n-1}$.

Iterate that process and you get each digit $a_n$ of the square root.