Find palindromic numbers in both binary and ternary bases: Difference between revisions
Find palindromic numbers in both binary and ternary bases (view source)
Revision as of 06:38, 9 February 2023
, 1 year ago→{{header|jq}}: correct simplification
m (→{{header|jq}}: simplify) |
(→{{header|jq}}: correct simplification) |
||
Line 1,278:
def stream:
recurse(if . >= base then ./base|floor else empty end) | . % base ;
[stream] | reverse
| if base < 10 then map(tostring) | join("")
elif base <= 36 then map(if . < 10 then 48 + . else . + 87 end) | implode
|