#!/usr/bin/env python # coding: utf-8 # ## Challenges # ### Exercise # # Starting with the number and moving to the right in a clockwise direction a by # # spiral is formed as follows: # # ``` # 21 22 23 24 25 # 20 7 8 9 10 # 19 6 1 2 11 # 18 5 4 3 12 # 17 16 15 14 13 # ``` # # It can be verified that the sum of the numbers on the diagonals is 21+7+1+3+13+25+9+5+17=101. # # What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way? # # Hint: You do not need to compute this spiral, just take a close look at the numbers that are summed up. # In[ ]: # ### Exercise # #

Find the number of integers $1 \lt n \lt 10^7$, for which $n$ and $n + 1$ have the same number of positive divisors. For example, $14$ has the positive divisors $1, 2, 7, 14$ while $15$ has $1, 3, 5, 15$.

# In[ ]: # ### Exercise # #

If $p$ is the perimeter of a right angle triangle with integral length sides, $\{a, b, c\}$, there are exactly three such triangles for $p = 120$:

#

$\{20,48,52\}$, $\{24,45,51\}$, $\{30,40,50\}$

#

For which value of $p \le 1000$, is the number of such triangles maximised?

# In[ ]: # ### Exercise # # Given two sorted lists, write a function to merge these lists into a new sorted list. # # Example: `[1,2,5,6,6,7]` and `[2,3,8]` --> `[1,2,2,3,5,6,6,7,8]` # # No nesting of loops allowed! # In[ ]: # ### Exercise # # Given a string `s`, write a function to find the length of the longest substring without repeating characters. # # No nesting of for-loops allowed! # In[ ]: