Prime reciprocal sum: Difference between revisions

Content deleted Content added
Trizen (talk | contribs)
Added Sidef
Peak (talk | contribs)
Line 245: Line 245:


Tested in J9.4
Tested in J9.4

# rtrunc is like trunc but for Rational numbers, though the input may be
# either a number or a Rational.
def rtrunc:
if type == "number" then r(itrunc;1)
elif 0 == .n or (0 < .n and .n < .d) then r(0;1)
elif 0 < .n or (.n % .d == 0) then .d as $d | r(.n | idivide($d); 1)
else rminus( r( - .n; .d) | rtrunc | rminus; 1)
end;


=={{header|Julia}}==
=={{header|Julia}}==