Guest User

Untitled

a guest
Jul 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace EulerSolution
  7. {
  8. class Euler57
  9. {
  10. static int Main(string[] args)
  11. {
  12. PrimeGenerator prime1 = new PrimeGenerator(100);
  13. prime1.Generator();
  14. return 0;
  15. }
  16. static int FracList()
  17. {
  18. return 0;
  19. }
  20. static List<int> NextRoot2(List<int> frac_tuple)
  21. {
  22. var new_tuple = new List<int>();
  23. new_tuple.Add(frac_tuple[1]);
  24. new_tuple.Add(2 * frac_tuple[1] + frac_tuple[0]);
  25. return new_tuple;
  26. }
  27. }
  28. class PrimeGenerator
  29. {
  30. public int Generator()
  31. {
  32. int primeFlag = 1;
  33. for (int i = 0; i < Limit; i++)
  34. {
  35. primeFlag = 1;
  36. try
  37. {
  38. for (int j = 2; j < Math.Sqrt(i); j++)
  39. {
  40. if (i % j != 0)
  41. {
  42. primeFlag = 0;
  43. break;
  44. }
  45. }
  46. if (primeFlag == 1)
  47. {
  48. System.Console.WriteLine("{0}", i);
  49. }
  50. }
  51. catch (Exception ex)
  52. {
  53. }
  54. }
  55. return 0;
  56. }
  57. public PrimeGenerator(int limit1):
  58. this.Limit(limit1)
  59. {}
  60. }
  61. }
Add Comment
Please, Sign In to add comment