Integer roots: Difference between revisions

Content added Content deleted
(→‎{{header|Raku}}: simplifying tail condition)
Tag: Made through Tor
m (→‎{{header|J}}: clarify an ambiguity)
Line 541: Line 541:
<code><.@%:</code> satisfies this task. Left argument is the task's N, right argument is the task's X:
<code><.@%:</code> satisfies this task. Left argument is the task's N, right argument is the task's X:


'''Note:''' Depending on '''''N''''', one must select the proper number of digits, that is, ''2000'', ''2001'', ''2002'', etc..., otherwise the result will be the digits of the nth root of 20, 2000, etc...<br/>
'''Note:''' If you are looking for a decimal expansion of an integer root, one must select the proper number of digits for N, that is, ''2000'', ''2001'', ''2002'', etc..., otherwise the result will be the digits of the nth root of 20, 2000, etc...<br/>
For example, If you use "3 <.@%: (2*10x^2*200'''0''')" instead of "3 <.@%: (2*10x^2*200'''1''')", you will get an output starting with "271441761659490657151808946...", which are the first digits of the cube root of 20, not 2.
For example, If you use "3 <.@%: (2*10x^2*200'''0''')" instead of "3 <.@%: (2*10x^2*200'''1''')", you will get an output starting with "271441761659490657151808946...", which are the first digits of the cube root of 20, not 2. This constraint is independent of the task requirements, except in an illustrative sense, so will not be developed further, here.


<syntaxhighlight lang="j"> 9!:37]0 4096 0 222 NB. set display truncation sufficiently high for our results
<syntaxhighlight lang="j"> 9!:37]0 4096 0 222 NB. set display truncation sufficiently high for our results