jayped007

90 Reputation

6 Badges

19 years, 283 days

MaplePrimes Activity


These are answers submitted by jayped007

Hi,

I can help you a bit with the finalx,finaly computation.
Presuming its just syntax that you need help with.

For finaly, I wasn't sure what you wanted to do if somehow
digitalrootxval(k) was not either addfib(k) or minusfib(k),
so I just set value to zero in such case.  Please
adjust as necessary.

finaly := proc (n::integer)
 local k, y, rv;
 option remember;
 if n <= 1 then
  return n
 else
   y := array(0 .. n, [0, 1]);
   for k from 2 to n do
     rv := digitalrootxval(k);
     if rv = addfib(k) then
       y[k] := y[k-1]+combinat:-fibonacci(k)
     elif rv = minusfib(k) then
       y[k] := y[k-1]-combinat:-fibonacci(k)
     else
       y[k] := 0
     end if
   end do
 end if;
 return y[n]
end proc:

finalx := proc (n::integer)
 local k, x, rv;
 option remember;
 if n <= 1 then
 return n
 else
 x := array(0 .. n, [0, 1]);
 for k from 2 to n do
   x[k] := x[k-1]+digitalrootxval(combinat:-fibonacci(k+2)-1)
 end do
 end if;
 return x[n]
end proc:

-Jay Pedersen

 

Page 1 of 1