Charles is always very careful: whenever he has to choose a number that can have an impact on his life, he doesn't just do it. Charles always chooses the so-called $$v$$-perfect number, because he believes that this is a lucky number.
$$v$$-perfect numbers are strictly positive whole numbers of which the sum of their positive divisors equals a multiple of $$v$$ of the number itself. An example of a 3-perfect number is 120. The sum of all divisors of 120, namely \[1+2+3+4+5+6+8+10+12+15+20+24+30+40+60+120 = 360\] equals three times 120.
Write a function sumdivisors that prints the sum of the divisors of a given number $$n$$ (with $$n \in \mathbb{N}$$ and $$n > 0$$), that is given to the function as an argument.
Use the function sumdivisors to write a function vperfect, to which a number $$n$$ (with $$n \in \mathbb{N}$$ and $$n > 0$$) should be given as an argument. If the number $$n$$ is a $$v$$-perfect number, the function should print the value $$v \in \mathbb{N}$$ as a result. Otherwise, the function should print the value None.
Use the function vperfect to write a function search that searches the smallest $$v$$-perfect number in the interval $$[x, y]$$. The integers $$x$$ and $$y$$ must be given as arguments to the function. If the smallest $$v$$-perfect number $$n$$ can be found in the interval given, the function should print the tuple $$n, v$$ as a result. The function should print the value None if the interval doesn't contain any $$v$$-perfect numbers.
>>> print(sumdivisors(120))
360
>>> print(sumdivisors(121))
133
>>> print(vperfect(120))
3
>>> print(vperfect(121))
None
>>> print(search(5, 10))
(6, 2)
>>> print(search(50, 100))
None
>>> print(search(100, 150))
(120, 3)
>>> print(search(400, 500))
(496, 2)