Advertisement
brucehoult

Untitled

Apr 7th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <initializer_list>
  3.  
  4. void test(long long n){
  5.   for (auto i=3; i*i <= n; i+=2) if (n%i == 0) return;
  6.   std::cout << n << std::endl;
  7.   for (int d : {1,3,7,9}) test(10*n+d);
  8. }
  9.  
  10. int main(){
  11.   for (int d : {2,3,5,7}) test(d);
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement