Dan, Check out the message: http://www.jsoftware.com/pipermail/programming/2015-February/041095.html for one easy way to play with Knuth's up arrow notation in J.
From there it should be easy to code an alternative version of your adverb H. I never bother to do so because there are just a few numbers, to say the list, that you can actually compute for the hyper operations. As it has been pointed out before, J is relatively slow computing large numbers. Maybe Pascal's package can help but, of course, huge numbers are beyond the computer capabilities of J or any other programming language (in this universe, as is presently known, anyway). On Thu, Nov 19, 2015 at 3:51 PM, Dan Bron <[email protected]> wrote: > The notion of “hyper operation” extends the intuition that multiplication > is repeated addition, exponentiation is repeated multiplication, tetration > is repeated exponentiation, and so on. > > Hyperoperation can be defined piecewise (per Wikipedia) as: > > / b+1 if n = 0 > | a if n = 1, b = 0 > H_n(a,b) = | 0 if n = 2, b = 0 > | 1 if n >= 3, b = 0 > \ H_n-1( a, H_n(a, b-1) ) otherwise > > Or, in J: > > H =: adverb define > : > if. 0=m do. > 1+y > elseif. (m > 0) *. (0=y) do. > (<:3<.m) { x,0,1 > elseif. do. > x (<:m) H x m H <:y > end. > ) > > Now, while J likes 2 (0 H) 3, 2 (1 H) 3, 2 (2 H) 3, and 2 (3 H) 3 just > fine, producing the expected results [1], it silently crashes (i.e. the IDE > simply disappears) on 2 (4 H) 3 . > > Now, I’m sure 2 tetration 3 is some absurdly large number and I wouldn’t > expect a result, but I’d prefer a stack error (or whatever) to a crash. > > -Dan > > [1] Representing successor, addition, multiplication, and exponentiation > respectively. > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
