Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://mathoverflow.net/questions/451464/a-recurrence-for-the-even-numbers-in-terms-of-a-sum-of-pairs-of-prime-numbers-i
- "Mathematica start"
- Clear[a, n, nn, k, t, A];
- $RecursionLimit = 1000;
- "Size of matrix A is nn"
- nn = 42;
- t[n_, k_] :=
- t[n, k] =
- If[Or[And[n == 1, k == 1], And[n == 2, k == 1]], 0,
- If[k <= 3, 1, 0]*
- If[And[PrimeQ[n] == True, PrimeQ[k] == True,
- If[And[n == 1, k == 1], 0, Mod[n + k, 2] == 0]],
- If[n >= k, (n + k), 0], 0] +
- If[k >= 4,
- If[n >= 2, 1, 0]*(t[n, k - 2] + 2)*Sign[t[n, k - 2]]*
- Product[(1 - Sign[t[n + 2*j, k - 2*j]]), {j, 1, (k - 3)}], 0]];
- MatrixForm[
- A = Table[
- Table[If[
- Or[And[n == 2, k == 1], And[n == 1, k == 1],
- And[n == 2, k == 2]], 0, If[n >= k, t[n, k], 0]], {k, 1,
- nn}], {n, 1, nn}]]
- DeleteCases[Flatten[A], 0]
- Differences[%]
- "Mathematica end"
- "Mathematica start"
- Clear[a, n, nn, k, t, A];
- $RecursionLimit = 1000;
- "Size of matrix A is nn"
- nn = 400;
- t[n_, k_] :=
- t[n, k] =
- If[Or[And[n == 1, k == 1], And[n == 2, k == 1]], 0,
- If[k <= 3, 1, 0]*
- If[And[PrimeQ[n] == True, PrimeQ[k] == True,
- If[And[n == 1, k == 1], 0, Mod[n + k, 2] == 0]],
- If[n >= k, (n + k), 0], 0] +
- If[k >= 4,
- If[n >= 2, 1, 0]*
- If[n >= k, (1 - Sign[Sum[t[n, j], {j, 1, k - 1}]])*(Mod[n,
- 2])*(n + 3)*Sign[t[n - 2, k - 2]], 0], 0]];
- MatrixForm[
- A = Table[
- Table[If[
- Or[And[n == 2, k == 1], And[n == 1, k == 1],
- And[n == 2, k == 2]], 0, If[n >= k, t[n, k], 0]], {k, 1,
- nn}], {n, 1, nn}]];
- Sort[DeleteCases[Flatten[A], 0]]
- Differences[%]
- Differences[%]
- DeleteDuplicates[%]
- "Mathematica end"
Advertisement
Add Comment
Please, Sign In to add comment