An advantage of solutions based on taking cube roots, on the expression >.@%: in particular, is working correctly with large integers. For example:
g=: = (^&3 - ])@:(3&(>.@%:)) n=: */ 0 1 2 + 11^20x n 304481639541418099575807073027324053193216441247734861355941206 g n 1 g n+1 0 In contrast: p. (-n),2 3 1 ┌─┬────────────────────────────────────────────────────────┐ │1│6.7275e20 _3.36375e20j5.82619e20 _3.36375e20j_5.82619e20│ └─┴────────────────────────────────────────────────────────┘ p. (-n+1),2 3 1 ┌─┬────────────────────────────────────────────────────────┐ │1│6.7275e20 _3.36375e20j5.82619e20 _3.36375e20j_5.82619e20│ └─┴────────────────────────────────────────────────────────┘ (p. (-n),2 3 1) -:!.0 p.(-n+1),2 3 1 1 The last expression shows that a solution based on p. can not discriminate between n and n+1. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
