8 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
source | link

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a commentGlenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    
7 Syntax coloring
source | link

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    
    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    
    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    
6 Added Horizontal alternative
source | link

Bash – 42 bytes

#!/bin/bash
echo $((2#100))
echo $((2#10))

Yep, that's exactly 42 bytes of sourcecode to output:

4
2

EDIT: Horizontal alternative

Glenn correctly noted in a comment that you could write the 4 and the 2 on a single line too. Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion echo ($((2#100))($((2#100)) merely uses 41 bytes, which is not what I wanted.

Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

#!/bin/bash
echo $((2#00100)) $((2#00010))

Note that this is almost the same as what Glenn suggested, but with an added space character between both numbers – to make the sourcecode exactly fit 42 bytes like the other version. It's output will be:

4 2
  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    

Bash – 42 bytes

#!/bin/bash
echo $((2#100))
echo $((2#10))

Yep, that's exactly 42 bytes of sourcecode to output:

4
2

EDIT: Horizontal alternative

Glenn correctly noted in a comment that you could write the 4 and the 2 on a single line too. Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion echo ($((2#100))($((2#100)) merely uses 41 bytes, which is not what I wanted.

Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

#!/bin/bash
echo $((2#00100)) $((2#00010))

Note that this is almost the same as what Glenn suggested, but with an added space character between both numbers – to make the sourcecode exactly fit 42 bytes like the other version. It's output will be:

4 2

Bash – 42 bytes

  1. Vertical Version

    #!/bin/bash
    echo $((2#100))
    echo $((2#10))
    

    Yep, that's exactly 42 bytes of sourcecode to output:

    4
    2
    
  2. Horizontal Version

    After I posted the “Vertical Version”, Glenn correctly noted in a comment that you could write both numbers on a single line too by writing echo $((2#00100))$((2#00010)). Yet, the prepended zeros wouldn't depict full bytes (which would expect 8 binary characters per byte), which was the main reason why I initially opted-out of posting that solution. Also, Glenn's suggestion merely uses 41 bytes, which is not what I intended.

    Nevertheless, to add a horizontal alternative which – again – uses 42 bytes of sourcecode:

    #!/bin/bash
    echo $((2#000100))$((2#00010))
    

    Note that this is almost the same as what Glenn suggested, but with an added 0 in the first binary representation, which make the sourcecode exactly fit 42 bytes. It's output will be:

    42
    
5 Added Horizontal alternative
source | link
4 Rollback to Revision 2
source | link
3 Rollback to Revision 1
source | link
2 deleted 2 characters in body
source | link
1
source | link