Maria's Puzzle Book Reloaded [Puzzle 26]

But which two letters are we supposed to do? Because I’m sure there are more than one set of numbers whose first and last letters are the same.

So there are only a few ways that numbers can start and end, so this shouldn’t be hard.

Let’s begin with how numbers end because it’s easier to think if any numbers at all start with something, so we can start from here and work backwards to make it easier on our heads.

E: numbers that end with one, three, five, nine or twelve. e.g. 8012 -> eight thousand and twelve
O: numbers that end with two. e.g. 100432 -> one hundred thousand, four hundred and thirty two
R: numbers that end with four. There aren’t any numbers that start with R, so we can forget this.
X: numbers that end with six. There aren’t any numbers that start with X, so we can forget this.
N: numbers that end with seven, ten, eleven, any of the teens (13, 14, 15, 16, 17, 18, 19), or one million itself, e.g. 9010 nine thousand and ten
T: numbers that end with eight, e.g. 20098 -> twenty thousand and ninety eight
Y: numbers that end with twenty, thirty, forty, fifty, sixty, seventy, eighty or ninety. There aren’t any numbers that start with Y, so we can forget this.
D: numbers that end with hundred or thousand. There aren’t any numbers that start with D, so we can forget this.

I think that’s all of them. So we can have Es, Os, Ns and Ts to deal with.

So let’s go over each of these in alphabetical order this time.

E: Starting with E is simple-ish. Those that begin with 8 fall into here.
I said before that numbers that end in 1, 3, 5 or 9 fall here. This isn’t the case for numbers that end in 11, 13, 15 or 19 so we have to look out for the tens digit. Numbers that end in 12 also fall in here.

N: Starting with N is simple-ish. Those that begin with 9 fall into here.
As for ending, because seven and seventeen fall into this, ANY number ending in 7 will fall into this category (yay!). Numbers ending in 10 fall here as well, as do 11, 13, 14, 15, 16, 17, 18 and 19. While 1,000,000 ends in N it begins with O so it isn’t part of this…

O: Those that begin with 1 fall into here (except 10, though that would end in N so it wouldn’t work anyway)
Numbers that end in 2, except ones that end in 12, nice and simple.

T: There’s a few ways to start with T. Those that begin with 2 and 3 fall here, as do those that start with 10, though that’s a bit complex…
Numbers that end in eight, except ones that end in eighteen, nice and simple.

I’m not sure how we should go through this.

1 Like

Carl Friedrich decided to do the exercise in Finnish, and the word for “thousand” is the only word in range 1 to 1000000 that fulfills the condition. So, the answer is 1000.

4 Likes

good point midsummer.
@VyseGolbez what country are they in?

They are in England, so working with english numbers is what I want you to do. So no, @midsummer , Carl Friedrich did not do the excercise in finnish.

dammit, if he’d have said UK instead of england we could’ve tried in welsh

Ah well…

Okay I tried to do something, the amout of numbers with the same letters
From 100-199 = 9 (the sum is 1358)
From 1000-1999 = 90 (the sum is 135080)
So I guess 10000-19999 the sum will be 1350080
but
From 200-299 = 9 (the sum is 2312)
From 2000-2999 = 90 (the sum is 225620)

Another fun thing
From 200-299 (the sum is 2312)
From 300-399 (the sum is 3212)
the difference is 900
From 2000-2999 (the sum is 225620)
From 3000-3999 (the sum is 315620)
the difference is 90k

So there is a pattern i guess

Okay I think the easiest way here is building the progressions and finding the sum

For example from
10000-19999
10002 10022 10032 10042 10052 10062 10072 10082 10092
10102 10122 10132 10142 10152 10162 10172 10182 10192
difference between 2 rows is exactly 900
so we have 9 numbers in each column and we have to do like 100 rows of combinations so 900 numbers
Sn = ((a1+an)/2) * n
so we have S900 = ((90458 (sum of first row) + 899558)/2) * 900 = 445507200
a900=90458+900 * 899

I tried to count everything this way but I might have made a mistake somewhere I got
4173392237302

Actually I remembered that 11000 is eleven thousand so this method wont apply for 10000-19999 but I think it works for other big numbers

Recounted again and got 4414488098580

(Vyse say something… :blushing:)

Both are wrong.

:mii:but do you really know

Yes.

Is using programming to solve the puzzle allowed?

Yes, that would basically be doing it the brute force way, although I’ll tell you that it is not required.

import inflect

p = inflect.engine()
sum = 0

for i in range(1,1000001):
  word = p.number_to_words(i)
  if word[0] is word[-1]:
    sum += i
    print(word)

print(sum)

The answer would be 55862927592.

You can try it out in https://repl.it/languages/python3

so in python strings wrap around immediately, causing word [-1] to be the last letter?

Python indexing allows negative numbers to represent indices from the end of the array. So, -1 is the last index, -2 is the second-last, and so on. Applies to all arrays.

sum += i

?

It is a shorthand for “sum = sum + i”.

Yes, but wouldn’t that increase the sum by 19 for the number “19” instead of actually just counting them?