SHARE
TWEET

Fredholm Rueppel sequences

MatsGranvik Apr 21st, 2013 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*Mathematica 8*)
  2. (*program start*)
  3. Clear[t];
  4. modulus = 1;
  5. nn = 100;
  6. t[n_, 1] = 1;
  7. t[1, k_] = 1;
  8. t[n_, k_] :=
  9.   t[n, k] =
  10.    If[n < k,
  11.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  12.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  13. Table[Total[
  14.   Table[t[n, k]*
  15.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  16.      1], {k, 1, n}]], {n, 1, nn}]
  17. (*program end*)
  18. (*program start*)
  19. Clear[t];
  20. modulus = 2;
  21. nn = 100;
  22. t[n_, 1] = 1;
  23. t[1, k_] = 1;
  24. t[n_, k_] :=
  25.   t[n, k] =
  26.    If[n < k,
  27.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  28.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  29. Table[Total[
  30.   Table[t[n, k]/
  31.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  32.      1], {k, 1, n}]], {n, 1, nn}]
  33. (*program end*)
  34. (*program start*)
  35. Clear[t];
  36. modulus = 3;
  37. nn = 100;
  38. t[n_, 1] = 1;
  39. t[1, k_] = 1;
  40. t[n_, k_] :=
  41.   t[n, k] =
  42.    If[n < k,
  43.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  44.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  45. Table[Total[
  46.   Table[t[n, k]/
  47.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  48.      1], {k, 1, n}]], {n, 1, nn}]
  49. (*program end*)
  50. (*program start*)
  51. Clear[t];
  52. modulus = 4;
  53. nn = 100;
  54. t[n_, 1] = 1;
  55. t[1, k_] = 1;
  56. t[n_, k_] :=
  57.   t[n, k] =
  58.    If[n < k,
  59.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  60.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  61. Table[Total[
  62.   Table[t[n, k]*
  63.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  64.      1], {k, 1, n}]], {n, 1, nn}]
  65. (*program end*)
  66. (*program start*)
  67. Clear[t];
  68. modulus = 5;
  69. nn = 100;
  70. t[n_, 1] = 1;
  71. t[1, k_] = 1;
  72. t[n_, k_] :=
  73.   t[n, k] =
  74.    If[n < k,
  75.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  76.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  77. Table[Total[
  78.   Table[t[n, k]/
  79.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  80.      1], {k, 1, n}]], {n, 1, nn}]
  81. (*program end*)
  82. (*program start*)
  83. Clear[t];
  84. modulus = 6;
  85. nn = 100;
  86. t[n_, 1] = 1;
  87. t[1, k_] = 1;
  88. t[n_, k_] :=
  89.   t[n, k] =
  90.    If[n < k,
  91.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  92.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  93. Table[Total[
  94.   Table[t[n, k]*
  95.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  96.      1], {k, 1, n}]], {n, 1, nn}]
  97. (*program end*)
  98. (*program start*)
  99. Clear[t];
  100. modulus = 7;
  101. nn = 100;
  102. t[n_, 1] = 1;
  103. t[1, k_] = 1;
  104. t[n_, k_] :=
  105.   t[n, k] =
  106.    If[n < k,
  107.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  108.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  109. Table[Total[
  110.   Table[t[n, k]/
  111.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  112.      1], {k, 1, n}]], {n, 1, nn}]
  113. (*program end*)
  114. (*program start*)
  115. Clear[t];
  116. modulus = 8;
  117. nn = 100;
  118. t[n_, 1] = 1;
  119. t[1, k_] = 1;
  120. t[n_, k_] :=
  121.   t[n, k] =
  122.    If[n < k,
  123.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  124.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  125. Table[Total[
  126.   Table[t[n, k]*
  127.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  128.      1], {k, 1, n}]], {n, 1, nn}]
  129. (*program end*)
  130. (*program start*)
  131. Clear[t];
  132. modulus = 9;
  133. nn = 100;
  134. t[n_, 1] = 1;
  135. t[1, k_] = 1;
  136. t[n_, k_] :=
  137.   t[n, k] =
  138.    If[n < k,
  139.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  140.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  141. Table[Total[
  142.   Table[t[n, k]*
  143.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  144.      1], {k, 1, n}]], {n, 1, nn}]
  145. (*program end*)
  146. (*program start*)
  147. Clear[t];
  148. modulus = 10;
  149. nn = 100;
  150. t[n_, 1] = 1;
  151. t[1, k_] = 1;
  152. t[n_, k_] :=
  153.   t[n, k] =
  154.    If[n < k,
  155.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  156.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  157. Table[Total[
  158.   Table[t[n, k]*
  159.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  160.      1], {k, 1, n}]], {n, 1, nn}]
  161. (*program end*)
  162. (*program start*)
  163. Clear[t];
  164. modulus = 11;
  165. nn = 100;
  166. t[n_, 1] = 1;
  167. t[1, k_] = 1;
  168. t[n_, k_] :=
  169.   t[n, k] =
  170.    If[n < k,
  171.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  172.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  173. Table[Total[
  174.   Table[t[n, k]/
  175.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  176.      1], {k, 1, n}]], {n, 1, nn}]
  177. (*program end*)
  178. (*program start*)
  179. Clear[t];
  180. modulus = 12;
  181. nn = 100;
  182. t[n_, 1] = 1;
  183. t[1, k_] = 1;
  184. t[n_, k_] :=
  185.   t[n, k] =
  186.    If[n < k,
  187.     If[And[n > 1, k > 1], Sum[-t[k - i, n], {i, 1, n - 1}], 0],
  188.     If[And[n > 1, k > 1], Sum[-t[n - i, k], {i, 1, k - 1}], 0]];
  189. Table[Total[
  190.   Table[t[n, k]*
  191.     If[And[Mod[n, modulus] == 0, Mod[k, modulus] == 0], 1 - modulus,
  192.      1], {k, 1, n}]], {n, 1, nn}]
  193. (*program end*)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top