WEBVTT

00:00.240 --> 00:05.040
Sometimes, when you're trying to come up with a 
sequence or just looking into patterns and things,

00:05.040 --> 00:10.880
you find a rule and it turns out there is no next 
option. The rule you wanted just doesn't work.

00:10.880 --> 00:16.640
Here's a sequence I found in the OEIS - the 
Online Encyclopedia of Integer Sequences - that

00:16.640 --> 00:23.680
grabbed my eye, because it's called "the 
infinite trunk of least squares beanstalk".

00:23.680 --> 00:26.640
And there's really not much 
more explanation than that,

00:26.640 --> 00:32.640
which is really... if that doesn't pique your 
curiosity, what will? It says it's the only

00:32.640 --> 00:37.280
infinite sequence - we haven't learnt anything new 
yet, it said infinite at the beginning - such that

00:37.280 --> 00:47.120
a(0) is zero and a(n-1) is a(n) minus the 
least number of squares that sum to a(n).

00:47.840 --> 00:53.120
So, it said 'least squares beanstalk'. We've 
got the least number of squares again. And

00:53.120 --> 00:59.360
then there's no other explanation about 
what that means, how you work it out. Oof!

00:59.360 --> 01:05.120
I've just spent a few minutes doodling, working 
out what that means, and it's actually quite nice!

01:05.120 --> 01:10.400
One of the problem with the OEIS is, because there 
isn't much space for explaining what you mean,

01:10.400 --> 01:17.280
the titles tend to be a bit oblique, like this 
one, and then you'd want a bit more motivation,

01:17.280 --> 01:21.600
explanation, links to things. I think the 
assumption is that you will have published

01:21.600 --> 01:25.920
something somewhere else about it. 
But no such link on this entry.

01:25.920 --> 01:40.160
So, the sequence is - and I'll copy it down - 
A276573. If you're watching this when the OEIS

01:40.160 --> 01:44.720
has moved to seven digits, hello person from 
the future! I wonder how far away that is.

01:44.720 --> 01:54.880
And it goes 0, 3, 6, 8, 11, 15, 16, 
18, 21, ... and we'll stop there.

01:54.880 --> 01:59.760
OK, so it said it's infinite. My dot-dot-dot 
is correct there, it's going to go on forever.

01:59.760 --> 02:03.680
Where do these numbers come from? What 
do they mean? Where's the beanstalk?

02:03.680 --> 02:07.280
So it says it's the only infinite 
sequence such that this particular

02:07.280 --> 02:11.440
rule is followed. So maybe there are 
other ways of trying to follow this

02:11.440 --> 02:16.960
rule that make a not infinite 
sequence. So that's intriguing.

02:16.960 --> 02:24.800
First thing to try out is - it goes 0, 3, so 
start going 0, 1 must stop. So let's try that!

02:24.800 --> 02:28.960
So I'll write my zero. We'll start 
with... let's try and make it a beanstalk,

02:28.960 --> 02:35.280
eh? So write a zero here. I'm going to 
try and go upwards, like beanstalks do.

02:35.280 --> 02:40.720
Up to 1. So does that obey the rule? What's 
the rule again? I'll write it down. a(n-1)

02:42.000 --> 02:49.200
is a(n) minus least number of squares, 
which is another sequence in the OEIS,

02:49.200 --> 02:56.960
so I'll give it its number. 
A002828. Nice number! Of a(n).

02:58.720 --> 03:06.560
Right, so I know a(n-1). That's my zero. 
And I need that to... I need an a(n) that

03:06.560 --> 03:14.320
satisfies this rule, so a next term. So does 1 
satisfy it? So, if a(n) is 1, the least number

03:14.320 --> 03:22.720
of square numbers that sum up to that is 1. 1 
is a square number, 1 adds up to 1. OK, cool.

03:22.720 --> 03:26.640
So 1 - 1 = 0. Bingo.

03:27.440 --> 03:38.720
Now next, I need to find another number for 
my a(2)... so that's a(0), that's a(1). I need

03:38.720 --> 03:46.480
a(2) to be something that if I take away the 
number of squares that add up to it, I get 1.

03:46.480 --> 03:50.080
I don't know off the top of my head 
how many squares you need to add up

03:50.080 --> 03:56.960
to certain numbers. We could try working a 
few out, I suppose. So I'll go over here...

03:56.960 --> 04:02.680
We've got n and A002828 of n.

04:02.680 --> 04:03.600
Bloop!

04:03.600 --> 04:08.880
Right, so zero. How many squares add up to 
zero? If I add up zero squares then I get zero.

04:08.880 --> 04:17.600
One, one. Two, um... I need two squares. 
One plus one. Three, I need three squares.

04:17.600 --> 04:23.360
Four, that's a square number. I only need 
one square number. Four's a square number.

04:23.360 --> 04:30.320
Five is four plus one, so that's two. Six is 
four plus one plus one, that's three. Seven,

04:32.160 --> 04:34.613
four plus one plus one plus one.

04:34.613 --> 04:36.160
For eight, four plus four, two squares!

04:36.160 --> 04:39.040
So, right, this carries on forever.

04:40.720 --> 04:49.600
I need a number such that the difference 
between these two things is one.

04:49.600 --> 04:53.360
Can you see one?

04:53.360 --> 04:54.160
I can't.

04:54.960 --> 04:58.560
Now, cleverly, I've gone off the edge 
of shot there, so I'm going to go over

04:58.560 --> 05:02.560
to the left here. So this is the difference 
over here. I'll write down the differences.

05:02.560 --> 05:08.560
0, 0, 0, 0, 3, 3, 3, 3, 6.

05:08.560 --> 05:13.920
A person might be inclined to think at this 
point, does this thing always go up? Certainly

05:13.920 --> 05:17.600
not going to come back down to one again because 
it's a theorem that every number can be written

05:17.600 --> 05:23.840
as the sum of at most four square numbers. 
OEIS says that Lagrange came up with that.

05:23.840 --> 05:28.720
Nothing's going to have a 1 in this column, 
which is what I want. So 1 doesn't work. That

05:28.720 --> 05:35.440
is a finite beanstalk, which means 
I've got to rub it out. Excuse me.

05:35.440 --> 05:38.640
So, we're getting there. We can 
rule out two by the same logic.

05:39.440 --> 05:44.400
Can't see any twos in this column, 
it's not coming back down to two.

05:44.400 --> 05:51.360
Shall we go three? Three's the last choice I 
could've had, because it's the last thing where

05:51.360 --> 05:57.360
the difference is zero. So in order for this 
to work at all, it's going to have to be three.

05:57.360 --> 06:02.080
Sometimes, when you're trying to come up with a 
sequence or just looking into patterns and things,

06:02.080 --> 06:10.720
you find a rule and it turns out there is no next 
option. The rule you wanted just doesn't work.

06:10.720 --> 06:14.000
Right.
So next term's three.

06:14.000 --> 06:17.120
That's my a(1).
So again, next,

06:17.120 --> 06:19.840
I've got to choose the next term. What's my a(2)?

06:20.560 --> 06:29.360
So I want something that when you take away the 
number of squares counting function you get three.

06:29.360 --> 06:33.760
So I want something with a three in this 
difference column. My choices are four, five

06:33.760 --> 06:42.960
And, yet again, I'm going to use the 
fact that this differences sequence,

06:42.960 --> 06:46.400
I don't think decreases. I'm 
pretty sure it doesn't decrease.

06:46.400 --> 06:52.000
So four is out, five is out, six will work.
So just so you can -- ooh, hang on.

06:52.000 --> 07:01.680
So a(1) is three. So a(2)... 
three equals six minus,

07:01.680 --> 07:05.040
that thing over there, the 
thing in the six column. Three.

07:05.040 --> 07:08.320
So three is six minus three. Works. Bingo.

07:08.320 --> 07:13.520
I've got, I think, a rough idea of how this 
thing works. So if I keep extending this table

07:13.520 --> 07:21.040
down and I use the rule of, I try and look in 
the column here for the last term I had, then

07:21.760 --> 07:25.360
hopefully I'll always find something that works.

07:25.360 --> 07:27.760
I'll quite often have a few choices. So some of

07:27.760 --> 07:32.000
them might end up going down a dead 
end that won't carry on any further.

07:32.000 --> 07:37.360
So I'll get a trunk. And I think the beanstalk 
thing is the fact that I've got this infinite

07:37.360 --> 07:42.080
trunk that keeps going, but those other 
numbers that I could have tried from there,

07:42.080 --> 07:46.160
the other options from here, those might 
be branches coming off it. Those don't

07:46.160 --> 07:49.920
have to be infinite. I can have like 
finite little branches coming off.

07:49.920 --> 07:55.200
So, does that work? Well, off zero. I tried one,

07:55.200 --> 08:02.800
that didn't work. And I tried two -- actually, 
I'm going to do a bit of erasing again.

08:03.920 --> 08:07.920
I'm going to start with zero much lower down 
now. Zero. And I know that that goes up to

08:07.920 --> 08:14.480
three and then six, and then looking 
ahead of what I copied off the OEIS,

08:14.480 --> 08:18.640
11, 15. Is that enough to get the idea? Let's see.

08:18.640 --> 08:22.080
From zero, I could have tried one, 
but it didn't work and I could have

08:22.080 --> 08:27.360
tried two. That didn't work. 
That's not a great two. Three.

08:27.920 --> 08:37.520
So could four have worked from three? Let's 
see. So four is the sum of one square,

08:37.520 --> 08:46.480
so four minus one equals three. So I could have 
got there from three. And the same with five. Six,

08:46.480 --> 08:52.600
seven, ... where are we? Seven is the sum of four 
squares. So that comes off three as well, whoop!

08:52.600 --> 08:55.200
I thought that might come from further up. So

08:55.200 --> 08:58.960
then eight's the one that works 
-- sorry, six! And then eight.

08:58.960 --> 09:06.240
Nine is, ... I need to write some 
more bits. You know what? Let's go

09:06.240 --> 09:13.040
to the OEIS. Let's find this thing. There's 
a list of these. I want this table. So nine,

09:13.040 --> 09:17.760
is the sum of one square. Well, I 
could have said that, couldn't I?

09:17.760 --> 09:23.280
Stop there. Okay. So, nine. 
Oh, let's do these differences.

09:25.760 --> 09:32.400
10 and 11 also come off eight. 12 comes 
off nine. So we've got a branch that's not

09:32.400 --> 09:38.640
trivial here. We're going two steps along, 
but it will turn out to not work later on.

09:38.640 --> 09:42.960
13, 14, 15 all come off 11. So...

09:42.960 --> 09:49.680
The Beanstalk carries on upwards from 
15. Infinitely. So there we go, that's

09:50.480 --> 09:54.240
the infinite least squares beanstalk. 
Glad I've made some sense of it.

09:54.240 --> 09:57.200
Now there's loads of questions 
that this brings up that I would

09:57.840 --> 10:01.200
I really like to answer from 
here. I'm not going to do it now.

10:01.200 --> 10:04.720
How do we prove it's infinite? I 
think if we maybe know the fact

10:04.720 --> 10:10.640
that this thing is always monotonic, 
maybe every... Well, ... here's an

10:10.640 --> 10:15.840
easy question. Does every number fit 
on to this infinite beanstalk somehow?

10:15.840 --> 10:18.720
The answer is yes, because, 
well sort of by induction.

10:18.720 --> 10:26.480
If I've got some really big number, I then 
subtract the number of squares that you need.

10:26.480 --> 10:30.640
This function, I need to give this a better 
name. The number of squares counting function.

10:30.640 --> 10:35.360
Subtract that, I get a smaller number which, 
by induction, I've said is in the Beanstalk.

10:35.360 --> 10:41.360
So I've covered a few things here. So 
I just need that to not be a gap of

10:41.360 --> 10:48.320
four in this thing here. So, I don't know. 
Maybe that is enough, maybe I've got it,

10:48.320 --> 10:50.880
maybe I need to do a little bit more thinking.

10:50.880 --> 10:53.440
Lovely Beanstalk. Cool!
