In the following link:


we can see the first 10,000 prime numbers $p$ with the property that both

$(3p)^2 + p^2 + 3^2$


$(3p)^2 - p^2 - 3^2$ are primes

The primes $p$ with this property satisfie that both $10p^2 + 9$ and $8p^2-9$ are also primes. How can I extend the list to find how many primes are up to $N$ beyond the $10,000$ such primes listed in the link, using Wolfram Alpha?

I don't have mathematica, so maybe there's a limitation in the computational power available in Wolfram Alpha for this kind of operation.

If someone can find quickly how many such primes there are, let's say, up to $100,000,000$, I will appreciate the help.

  • 1
    $\begingroup$ WolframAlpha understands this Select[Range[1,1000], PrimeQ[#]&& PrimeQ[(3*#)^2+#^2+3^2]&& PrimeQ[(3*#)^2-#^2-3^2]&] and checks numbers from 1 up to 1000 to see which of those qualify. If you change that range then you can check other numbers. I don't know how large a range your WolframAlpha will accept. $\endgroup$ – Bill Aug 18 '18 at 3:38

I don't know how to do this on WolframAlpha, but in Mathematica it is straightforward:

myList = Table[Prime[k], {k, 10^4}];

  PrimeQ[(3 #)^2 + #^2 + 9] && PrimeQ[(3 #)^2 - #^2 - 9] &]




This is the number of your special primes up to the $10000^{th}$ prime.

The $5761455^{th}$ prime is just over $10^8$ and substituting this into the above shows that the number of your special primes up to $10^8$ is $25,372$.

  • 1
    $\begingroup$ (Haven't tried, but...) I would think the free version of the Wolfram Cloud platform could also handle this computation. Mentioning that since poster does not have desktop Mathematica, and W|A might time out on this. $\endgroup$ – Daniel Lichtblau Aug 18 '18 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.