MatsGranvik

Goldbach problem attempt

Jul 26th, 2023
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. https://mathoverflow.net/questions/451464/a-recurrence-for-the-even-numbers-in-terms-of-a-sum-of-pairs-of-prime-numbers-i
  2.  
  3.  
  4. "Mathematica start"
  5. Clear[a, n, nn, k, t, A];
  6. $RecursionLimit = 1000;
  7. "Size of matrix A is nn"
  8. nn = 42;
  9. t[n_, k_] :=
  10. t[n, k] =
  11. If[Or[And[n == 1, k == 1], And[n == 2, k == 1]], 0,
  12. If[k <= 3, 1, 0]*
  13. If[And[PrimeQ[n] == True, PrimeQ[k] == True,
  14. If[And[n == 1, k == 1], 0, Mod[n + k, 2] == 0]],
  15. If[n >= k, (n + k), 0], 0] +
  16. If[k >= 4,
  17. If[n >= 2, 1, 0]*(t[n, k - 2] + 2)*Sign[t[n, k - 2]]*
  18. Product[(1 - Sign[t[n + 2*j, k - 2*j]]), {j, 1, (k - 3)}], 0]];
  19. MatrixForm[
  20. A = Table[
  21. Table[If[
  22. Or[And[n == 2, k == 1], And[n == 1, k == 1],
  23. And[n == 2, k == 2]], 0, If[n >= k, t[n, k], 0]], {k, 1,
  24. nn}], {n, 1, nn}]]
  25. DeleteCases[Flatten[A], 0]
  26. Differences[%]
  27. "Mathematica end"
  28.  
  29.  
  30.  
  31. "Mathematica start"
  32. Clear[a, n, nn, k, t, A];
  33. $RecursionLimit = 1000;
  34. "Size of matrix A is nn"
  35. nn = 400;
  36. t[n_, k_] :=
  37. t[n, k] =
  38. If[Or[And[n == 1, k == 1], And[n == 2, k == 1]], 0,
  39. If[k <= 3, 1, 0]*
  40. If[And[PrimeQ[n] == True, PrimeQ[k] == True,
  41. If[And[n == 1, k == 1], 0, Mod[n + k, 2] == 0]],
  42. If[n >= k, (n + k), 0], 0] +
  43. If[k >= 4,
  44. If[n >= 2, 1, 0]*
  45. If[n >= k, (1 - Sign[Sum[t[n, j], {j, 1, k - 1}]])*(Mod[n,
  46. 2])*(n + 3)*Sign[t[n - 2, k - 2]], 0], 0]];
  47. MatrixForm[
  48. A = Table[
  49. Table[If[
  50. Or[And[n == 2, k == 1], And[n == 1, k == 1],
  51. And[n == 2, k == 2]], 0, If[n >= k, t[n, k], 0]], {k, 1,
  52. nn}], {n, 1, nn}]];
  53. Sort[DeleteCases[Flatten[A], 0]]
  54. Differences[%]
  55. Differences[%]
  56. DeleteDuplicates[%]
  57. "Mathematica end"
Advertisement
Add Comment
Please, Sign In to add comment