Hi Cliff, It took a while but I got the explicit verb to work.
f=: 13 :'4 p.~(([:(2&^)>:),.~ _1r3 *([:(2&^)>:) + _1&^)y' f i.10 7 15 29 59 117 235 469 939 1877 3755 f 4 p.~ ([: 2&^ >:) ,.~ _1r3 * ([: 2&^ >:) + _1&^ Linda -----Original Message----- From: Programming <[email protected]> On Behalf Of Cliff Reiter Sent: Tuesday, November 27, 2018 12:38 PM To: [email protected] Subject: Re: [Jprogramming] Recursive verbs I like that solution. Here is another approach 4 p.~(2&^@>: ,.~ _1r3 * 2&^@>: + _1&^)i. 10 7 15 29 59 117 235 469 939 1877 3755 I found this by composing the linear poly's and noting the constant terms satisfy a two step recursion with eigenvalues 2 and _1. lc=.({.@[+{:@[*{.@]),*&{: lc/\.(7$_1 2,:1 2) _43 128 _21 64 _11 32 _5 16 _3 8 _1 4 _1 2 On 11/27/2018 11:06 AM, Raul Miller wrote: > Sure, ... that's a bit bulkier than I prefer, but it works. > > Here's another alternative: > > evenodd=: , (_1 2,:_1 4)&p.@{: > evenodd evenodd 4 > 4 7 15 29 59 > > Thanks, > ---------------------------------------------------------------------- For information about J forums see https://eur04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C677fb1d024fe4e3d937308d6548f1c93%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636789370963003978&sdata=iWGjGzFd70epkTr2UBP7DapC8imlNBoaBgTzKw3eTE8%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
