# Mathemagician and a number sequence

• Ah, Mathemagician, we meet again - said Heptis, master of numbers.
• Yes, yes. What puzzle do I need to solve to free the townspeople this time? - Mathemagician was already running late to his keynote adress at the Prestigitator/Numerologist conference.
• Why the simplest one, just continue my sequence of numbers.
• Shoot.
• 3.
• ... - Mathemagician waited
• Well?
• I don't know, is it three?
• not, it's 0.
• is minus three next.
• 6, actually.
• hm... so surely the next one is twenty one?
• trick question, it was 6 again!
• alright, but the one after that, is it minus fifteen?
• it's 3.
• Eighteen?
• 6
• ... eighteen?
• 5!
• I bet you're just reciting your mother's phone number, name five more numbers.
• no, it's a real sequence, so I can do this all day. 1,4,3,2,0
• Hurm - said Mathemagician, and that's when he called you for help.

TL;DR:

There's an infinite sequence: 3,0,6,6,3,6,5,1,4,3,2...

For partial credit guess the next two numbers, with some explanation.

For full credit tell me how I'm generating it

For bonus points: what the hell was Mathemagician doing?!

Honor rule: It's in OEIS, almost everything is, so please don't use it.

• A004606 (sorry to spoil it to you) Dec 29 '20 at 2:57

it's the base-7 expansion of pi.

Continuation of the sequence:

3,0,6,6,3,6,5,1,4,3,2,0,3,6,1, ...

How to get it:

you mentioned numerology in the question, so I guessed that a significant number was somehow involved. Since the sequence started with 3 (and coincidentally had 1,4 appearing later on), the decimal expansion of pi sprang to mind. I'm well aware of how using different bases can lead to interesting number sequences, so I searched for a list of pi in different bases and found this. Base 7 jumped out right away.

• Also, big hint with the name "Heptis" Oct 12 '16 at 17:03
• @ChrisCudmore Ah, good point. Oct 12 '16 at 20:08

Partial answer for what the Mathemagician was thinking:

After the first 3, he has no clue, so he waits because one number does not a sequence make. Then he guesses the same number again, just in case that was the entire sequence, one number repeated infinitely

After the second number, we have 3, 0.

The mathemagician guesses that the sequence subtracts three each time and the next number would be minus 3.

After the third number, we have 3, 0, 6.

Mathemagician now has enough of a sequence to work with here, or so he thinks. He looks at the differences between the three numbers and finds a shorter sequence, -3, 6. The difference between those two numbers is 9, so the next number in the addition sequence should be 15. He confidently guesses 21 as the next number, because 6 + 15 = 21

After his third wrong guess, the sequence we have is 3, 0, 6, 6.

The Mathemagician takes the same steps again, he looks at the sequence of differences, -3, 6, 0.
He then follows the exact same steps from the previous guess and looks at the differences here to get the sequence, 9, -6. If the pattern is subtracting 15 each time, this sequence becomes 9, -6, -21. The previous sequence must have it's next number found by subtracting 21, so it is now -3, 6, 0, -21. If we subtract 21 from the last number given to us by Heptis, we come up with -15 as the answer.

Unfortunately for the mathemagician, wrong again! The sequence is now 3, 0, 6, 6, 3.

He really likes his method he's been using, so he tries once more. The first sequence of differences is now -3, 6, 0, -3. The next is 9, -6, -3. The next is -15, 3. Aha! So we add 18 to get the next number in this sequence, -15, 3, 21. Add 21 to the previous sequence and we have 9, -6, -3, 18. Add eighteen to the previous sequence and we have -3, 6, 0, -3, 15. Add fifteen to the last number given by Heptis and the magician guesses 18.

Wrong again! The mathemagician is losing confidence in his method. But, he soldiers on. What's the sequence now, 3, 0, 6, 6, 3, 6? Okay.

You'll forgive me if I don't write down all the steps, but suffice to say, he looks at the sequences of differences again, going one step farther back this time, and the answer he finds is 18. He's fairly certain his methodology is flawed at this point, but he has to guess anyway.

After this point the Mathemagician basically gave up, so I'll stop here. If you need me to make my steps clearer I can, but the way I did this was by drawing a little pyramid of sequences, with like, arrows and stuff on paper, so it's not the most sophisticated method. I tried to explain as best I could.

• Another way to put it: he uses the method of differences to construct a polynomial through the given points. Oct 13 '16 at 3:00
• That's the one (apparently. I actually used Lagrange Interpolation* assuming the series if f(1),f(2),f(3) and so forth, but all the methods of course result in the same minimal order polynomial) I wish I could award 2 right answers. Oct 13 '16 at 13:02
• ( * ) Yes, I know I should've been use extra polation, but this is the only one I still remember how to do. Oct 13 '16 at 13:05