Advertisement
MatsGranvik

Modified version Eric Naslunds arithmetic sequence

Nov 8th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. (*Mathematica start*)
  2. Print["Try changing the power s of matrix A here:"]
  3. nn = 12;
  4. s = 5;
  5. A = Table[Table[If[Mod[n, k] == 0, k, 0], {k, 1, nn}], {n, 1, nn}];
  6. B = Table[
  7. Table[If[Mod[k, n] == 0, MoebiusMu[n], 0], {k, 1, nn}], {n, 1, nn}];
  8. MatrixForm[MM = MatrixPower[A, s].B];
  9.  
  10. Clear[t, n, k, M, x];
  11. t[n_, 1] = 0;
  12. t[1, k_] = 0;
  13. t[n_, k_] :=
  14. t[n, k] =
  15. If[n < k,
  16. If[And[n > 1, k > 1], x - Sum[t[k - i, n], {i, 1, n - 1}], 0],
  17. If[And[n > 1, k > 1], x - Sum[t[n - i, k], {i, 1, k - 1}], 0]];
  18. M = Table[Table[t[n, k], {k, 1, nn}], {n, 1, nn}];
  19. MatrixForm[M];
  20. Print["The roots of the ", s, "-th power of the matrix A"]
  21. (x /. Solve[Det[M + MM] == 0, x])
  22. Print["The modified Eric Naslund formula for the arithmetic sequence"]
  23. Table[MoebiusMu[n]^2*n^s/(n - EulerPhi[n]), {n, 2, nn}]
  24. (*Mathematica end*)
  25.  
  26.  
  27.  
  28. (*Mathematica start*)
  29. nn = 12;
  30. A = Table[Table[If[Mod[n, k] == 0, k, 0], {k, 1, nn}], {n, 1, nn}];
  31. B = Table[
  32. Table[If[Mod[k, n] == 0, MoebiusMu[n], 0], {k, 1, nn}], {n, 1, nn}];
  33. MatrixForm[M = MatrixExp[MatrixExp[MatrixExp[MatrixExp[A]]]].B];
  34.  
  35. Clear[t, n, k, x];
  36. t[n_, 1] = 0;
  37. t[1, k_] = 0;
  38. t[n_, k_] :=
  39. t[n, k] =
  40. If[n < k,
  41. If[And[n > 1, k > 1], x - Sum[t[k - i, n], {i, 1, n - 1}], 0],
  42. If[And[n > 1, k > 1], x - Sum[t[n - i, k], {i, 1, k - 1}], 0]];
  43. T = Table[Table[t[n, k], {k, 1, nn}], {n, 1, nn}];
  44. MatrixForm[T];
  45. Print["The roots of the matrix exponential of the matrix"]
  46. (x /. Solve[Det[M + T] == 0, x])
  47. Print["The modified Eric Naslund formula for the arithmetic sequence"]
  48. Table[MoebiusMu[n]^2*Exp[Exp[Exp[Exp[n]]]]/(n - EulerPhi[n]), {n, 2,
  49. nn}]
  50. (*Mathematica end*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement