logancberrypie

eyuker

Feb 6th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. long long int prime(long long int n)
  8. {
  9. bool flag = false;
  10. while (!flag)
  11. {
  12. flag = true;
  13. n += 1;
  14. for (int i = 2;i<n-1;i++)
  15. {
  16. if (n%i == 0)
  17. {
  18. flag = false;
  19. break;
  20. }
  21. }
  22. }
  23. return n;
  24. }
  25.  
  26. long long int a(long long int n)
  27. {
  28. if (n==1)
  29. {
  30. return prime(pow(10,14));
  31. }
  32. else {
  33. return prime(a(n-1));
  34. }
  35. }
  36.  
  37. long long int f(long long int n)
  38. {
  39. if (n==0)
  40. {
  41. return 0;
  42. } else if (n==1)
  43. {
  44. return 1;
  45. } else
  46. {
  47. return f(n-1) + f(n-2);
  48. }
  49. }
  50.  
  51. long long int b(long long int n)
  52. {
  53. return f(a(n));
  54. }
  55.  
  56. int main()
  57. {
  58. long long int total = 0;
  59. for (int i =0;i<100001;i++)
  60. {
  61. total += b(i);
  62. }
  63. cout << total << endl;
  64. }
Add Comment
Please, Sign In to add comment