Wolfram Mathematica 循环 Table
Wolfram Mathematica Recurrence Table
晚上好,我在使用 Wolfram Mathematica 时遇到了问题,如果有人能帮助我 post 解决方案,我将不胜感激。这是练习:
Print first 11 elements of the sequence a which is given with this reccurence relation: a(n+1) = 11a(n), where a(1) = 7, in which does not appear the number 3.
所以,我只需要不包含数字 3 的元素。
k[x_] := Module[{p, z},
p = RecurrenceTable[
{a[n + 1] == 11 a[n], a[1] == 7}, a, {n, 1, x}];
z = Flatten[First /@
Cases[{#, MemberQ[IntegerDigits[#], 3]} & /@
p, {_, False}]]]
m = 11;
While[Length[s = k[m]] < 11, m++]
s
{7, 77, 847, 102487, 12400927, 1500512167, 181561972207, 1997181694277, 241658985007517, 4709249964527920064407, 51801749609807120708477}
晚上好,我在使用 Wolfram Mathematica 时遇到了问题,如果有人能帮助我 post 解决方案,我将不胜感激。这是练习:
Print first 11 elements of the sequence a which is given with this reccurence relation: a(n+1) = 11a(n), where a(1) = 7, in which does not appear the number 3.
所以,我只需要不包含数字 3 的元素。
k[x_] := Module[{p, z},
p = RecurrenceTable[
{a[n + 1] == 11 a[n], a[1] == 7}, a, {n, 1, x}];
z = Flatten[First /@
Cases[{#, MemberQ[IntegerDigits[#], 3]} & /@
p, {_, False}]]]
m = 11;
While[Length[s = k[m]] < 11, m++]
s
{7, 77, 847, 102487, 12400927, 1500512167, 181561972207, 1997181694277, 241658985007517, 4709249964527920064407, 51801749609807120708477}