There are 500 windows in a building and Spiderman knows that behind one window, there is a villain. Spiderman labelled each window from 1-500 and using his Spider Senses, received hints to which window the villain is hiding behind. The following are the hints he received:
The number comprises three digits.
The number is a prime number in a prime position.
The number has a digital sum of 11.
The square of the number has six distinct digits.
From these hints, find out which window is the villain hiding behind
Explanation
1st - 2
2nd - 3
3rd - 5
4th - 7
If the number is in a prime position(e.g. 2nd, 3rd, llth), it is a prime in a prime position. The first prime in a prime position is therefore 3.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Using the Python sympy library:
sieve provides a list of primes that is extended as required. Its search function returns the position of a prime number within it as a pair of identical integers. The [0] thingy simply selects the first of them.