Esthetic numbers: Difference between revisions
Content added Content deleted
m (→{{header|jq}}: tweaks) |
|||
Line 4,155: | Line 4,155: | ||
if . == 0 then false |
if . == 0 then false |
||
else {i: (. % $b), n: ((./$b)|floor) } |
else {i: (. % $b), n: ((./$b)|floor) } |
||
| until (.n <= 0 |
| until (.n <= 0; |
||
(.n % $b) as $j |
(.n % $b) as $j |
||
| if (.i - $j)|length != 1 # abs |
| if (.i - $j)|length != 1 # abs |
||
then . |
then .n = -1 #flag |
||
else .n |= ((./$b)|floor) |
else .n |= ((./$b)|floor) |
||
| .i = $j |
| .i = $j |
||
end) |
end) |
||
| .n != -1 |
|||
| if .emit != null then .emit else true end |
|||
end; |
end; |
||
# depth-first search |
|||
# input: {esths} |
# input: {esths} |
||
def dfs($n; $m; $i): |
def dfs($n; $m; $i): |