Advertisement
Anon017706349

Untitled

Dec 10th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. bool isPrime(int n)
  8. {
  9. if (n <= 1)
  10. {
  11. return false;
  12. }
  13.  
  14. for (int i = 2; i <= sqrt(n); i++)
  15. {
  16. if (n % i == 0)
  17. {
  18. return false;
  19. }
  20. }
  21.  
  22. return true;
  23. }
  24.  
  25. int main()
  26. {
  27. int count = 0;
  28. int count2 = 0;
  29.  
  30. int even = 4;
  31. int pcount = 0;
  32.  
  33. vector<int> primevector;
  34. vector<int> evenvector;
  35.  
  36. while (pcount < 169)
  37. {
  38. if (isPrime(count2) == true)
  39. {
  40. primevector.push_back(count2);
  41. pcount = pcount + 1;
  42. }
  43.  
  44. count2 = count2 + 1;
  45. }
  46.  
  47. while (count < 1000)
  48. {
  49. evenvector.push_back(even);
  50.  
  51. count = count + 1;
  52. even = even + 2;
  53. }
  54.  
  55.  
  56.  
  57. /*
  58. while (pcount < 169)
  59. {
  60. if (isPrime(count2) == true)
  61. {
  62. cout << count2 << " pcount: " << pcount << endl;
  63. pcount = pcount + 1;
  64. }
  65.  
  66. count2 = count2 + 1;
  67. }
  68. */
  69. /*
  70. while (count < 1000)
  71. {
  72.  
  73. cout << even << " count: " << count << endl;
  74.  
  75. count = count + 1;
  76. even = even + 2;
  77. }
  78. */
  79.  
  80. /*
  81. ((evenvector[ucount] = primevector[i] +
  82. primevector[j])
  83. == true)
  84.  
  85. cout << evenvector[ucount] << " = "
  86. << primevector[i] << " + "
  87. << primevector[j] << " count: " << ucount;
  88. */
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement