Hide and seek with Spiderman(The previous answer was wrong)

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

  • A prime number in a prime position is where you label each prime in their order. For example :

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.

  • A digital sum of a number is the sum of all its digits. For example, the digital sum of 532 is 5+3+2 = 10.


The answer is 353.

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.

1 solution

Bill Bell
Jul 30, 2014

Using the Python sympy library:

>>> from sympy import *

>>> for w in range(101,499):

... if isprime(w) :

... if isprime (sieve.search(w)[0]):

... if sum([int(c) for c in str(w)]) == 11:

... if len(list(set([c for c in str(w*w)])))==6 :

... print w

...

353

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.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...