Skip to main content
Shortened entry to 127 bytes.
Source Link
J-L
  • 101
  • 2

[Ruby]Ruby, 139127 bytes

def f c;c=~c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/;$6
$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6);end

Try it online!Try it online!

[Ruby], 139 bytes

def f c;c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/;$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6);end

Try it online!

Ruby, 127 bytes

c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/
$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6)

Try it online!

Fixed the "Try it online!" link.
Source Link
J-L
  • 101
  • 2

Ruby[Ruby], 139 bytes

def f c;c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/;$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6);end

[Try it online!][TIO-jmif7t6q]

[TIO-jmif7t6q]: https://tio.run/##KypNqvz/PyU1TSFNIdk62bZOX1lDT9MeG9a3VjGzT7ZSV1bX1lAxtVcx1FYx0lYx1lYx0VYx1TKyUjEBi5mAhU0gMlYqxkBBLaCAEYgwBikzstcA69XUMrZSMQRJm1kpGShpmWlap@al/C8oADoFaAkXlBGKYIUhMcOR2REonEhUXpT6fwA "Ruby – Try It Online"22+$32:$2?($1+$2)3:$1?$16:"0"*6);endTry it online!

Ruby, 139 bytes

def f c;c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/;$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6);end

[Try it online!][TIO-jmif7t6q]

[TIO-jmif7t6q]: https://tio.run/##KypNqvz/PyU1TSFNIdk62bZOX1lDT9MeG9a3VjGzT7ZSV1bX1lAxtVcx1FYx0lYx1lYx0VYx1TKyUjEBi5mAhU0gMlYqxkBBLaCAEYgwBikzstcA69XUMrZSMQRJm1kpGShpmWlap@al/C8oADoFaAkXlBGKYIUhMcOR2REonEhUXpT6fwA "Ruby – Try It Online"22+$32:$2?($1+$2)3:$1?$16:"0"*6);end

[Ruby], 139 bytes

def f c;c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/;$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6);end

Try it online!

Source Link
J-L
  • 101
  • 2

Ruby, 139 bytes

def f c;c=~/#(.)?(.)?(.)?(.)?(.)?(.)?/;$6?c:'#'+($5?$1+$2+$3+$4+$5*2:$4?$1+$4+$2+$4+$3+$4:$3?$1*2+$2*2+$3*2:$2?($1+$2)*3:$1?$1*6:"0"*6);end

[Try it online!][TIO-jmif7t6q]

[TIO-jmif7t6q]: https://tio.run/##KypNqvz/PyU1TSFNIdk62bZOX1lDT9MeG9a3VjGzT7ZSV1bX1lAxtVcx1FYx0lYx1lYx0VYx1TKyUjEBi5mAhU0gMlYqxkBBLaCAEYgwBikzstcA69XUMrZSMQRJm1kpGShpmWlap@al/C8oADoFaAkXlBGKYIUhMcOR2REonEhUXpT6fwA "Ruby – Try It Online"22+$32:$2?($1+$2)3:$1?$16:"0"*6);end