```
In [ ]:
```

The nth term of the sequence of triangle numbers is given by, $t^n = 1/2 n(n+1)$; so the first ten triangle numbers are:

1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...

By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word value for SKY is 19 + 11 + 25 = 55 = $t_{10}$. If the word value is a triangle number then we shall call the word a triangle word.

Using words.txt (right click and 'Save Link/Target As...'), a 16K text file containing nearly two-thousand common English words, how many are triangle words?

```
In [1]:
```!wget 'https://projecteuler.net/project/resources/p042_words.txt'

```
```

```
In [29]:
```f=open('p042_words.txt')
words=f.read().replace('\"','').split(',')
def wordToNumberSum(s):
return sum([ord(i)-ord('A')+1 for i in s])
numbersum = map(wordToNumberSum,words)
def triangularLessThanN(n):
i=1
triangular=[]
while i*(i+1)/2 < n:
triangular.append(i*(i+1)/2)
i+=1
return triangular
triangular = triangularLessThanN(max(numbersum))
count=0
for i in numbersum:
for j in triangular:
if i == j:
count+=1
print count

```
```

The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property.

Let $d_1$ be the 1st digit, $d_2$ be the 2nd digit, and so on. In this way, we note the following:

$d_2 d_3 d_4$=406 is divisible by 2

$d_3 d_4 d_5$=063 is divisible by 3

$d_4 d_5 d_6$=635 is divisible by 5

$d_5 d_6 d_7$=357 is divisible by 7

$d_6 d_7 d_8$=572 is divisible by 11

$d_7 d_8 d_9$=728 is divisible by 13

$d_8 d_9 d_{10}$=289 is divisible by 17

Find the sum of all 0 to 9 pandigital numbers with this property.

```
In [ ]:
```