C++ 389 bytes
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/miller_rabin.hpp>
using namespace boost::random;typedef boost::multiprecision::cpp_int Z;int main(int,char**v){mt19937 m(clock());independent_bits_engine<mt11213b,256,Z>g(m);Z n{v[1]},p;while(p++<=n)if(miller_rabin_test(p,25,g)&&p.convert_to<std::string>().find( "666" )!=-1)std::cout<<p<<" ";}
This is a full program!
You'll need Boost to compile it. (Or copy and paste into your favorite online C++ shell.)
Run it from the command-line giving n as argument.
Ungolfed:
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/miller_rabin.hpp>
using namespace boost::random;
typedef boost::multiprecision::cpp_int integer;
int main( int argc, char** argv )
{
mt19937 mt( clock() );
independent_bits_engine <mt11213b, 256, integer> rng( mt );
integer input {argv[ 1 ]};
integer possible;
while (possible++ <= input)
if (
// is_prime( possible )
miller_rabin_test( possible, 25, rng )
&&
// possible has "666" in it
(possible.convert_to <std::string> ().find( "666" ) != std::string::npos))
std::cout << possible << " ";
}
Shortcuts were made in terms of random number testing. The original code started testing possible primes at 6661 and incremented by two. You'll also get a compiler warning because of that (-1) there instead of npos.
Still, this runs pretty quickly. It only took about 40 seconds to find all 214 satan primes under 1,000,000 on my old AMD Sempron 130.
:^D
1define "about a minute." Is it +- 30 seconds? I personally think that 30 minutes and a minute don't differ that much... Also bonuses are generally frowned upon... also I think this might have been better as an
output the nth satan primechallenge... – Socratic Phoenix – 2017-08-25T16:47:26.113ok ok people... bonus will be removed... – None – 2017-08-25T16:51:26.310
Hope you don't mind the edit I made to the challenge title. – Shaggy – 2017-08-25T17:29:39.857
3@Shaggy What point does the title change serve...? – Conor O'Brien – 2017-08-26T01:40:28.630
3@ConorO'Brien Rhyming and appearing archaic, I presume. – wizzwizz4 – 2017-08-26T15:17:28.760