0
votes

Good evening, I have a problem with Wolfram Mathematica and I would be grateful if someone could help me and post the solution. Here's the exercise:

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.

So, I need only the elements that doesn't contain the number 3.

1
show what you have tried - agentp
I have this: prntscr.com/70f8xq and I need only the red-labeled numbers (doesn't contain 3), but don't know how to do it with a condition. - Антонио Антовски
ok, you should put your code here (not a link). Next step look up IntegerDigits and Select and MemberQ - agentp

1 Answers

0
votes
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}