Sum of square and cube digits of an integer are primes: Difference between revisions
Sum of square and cube digits of an integer are primes (view source)
Revision as of 03:42, 26 February 2023
, 1 year ago→{{header|jq}}: def digits:
(jq) |
(→{{header|jq}}: def digits:) |
||
Line 418:
end;
# emit an array of the decimal digits of the integer input, least significant digit first.
def digits:
recurse( if . >= 10 then ((. - (.%10)) / 10) else empty end) | . % 10;
def digitSum:
def add(s): reduce s as $_ (0; .+$_);
add(digits);
</syntaxhighlight>
'''The Task'''
|