> 2 tetration 3 is some absurdly large number and I wouldn’t expect a result
I thought 2 (4 H) 3 should be 2^16
but I get
2 (4 H) 3
16
no crash though j802 win64
________________________________
From: Dan Bron <[email protected]>
To: J Programming <[email protected]>
Sent: Thursday, November 19, 2015 3:51 PM
Subject: [Jprogramming] Crash calculating large hyper operations
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