Write a program to print the sum of the ascii codes of the program
PHP, m4, and other cat-like languages: 150
Found this solution using a simple Haskell program to brute-force it:
f :: String -> Bool f s = (read s :: Int) == (sum . map fromEnum) s main = mapM_ print [filter f $ sequence $ replicate n ['0'..'9'] | n <- [1..10]]
This will not print the number 255, but rather the 255th ASCII character.
This might be considered cheating because the BF compiler skips over the
wc, prints 0
Someone said "cat-like languages", so...
An empty file:
wc -c file.wc. At 0 bytes, I think this is the winner in the 'not really a programming language' category.
cat, prints 80 (base 13)
No terminating newline, the number 8013 is equivalent to 104 in decimal. You can go shorter with 6017 (102 dec), but I figured "base 13" would be worth more geek points.
wc example, this one can be run as a program.
(As encoded in Latin-1 - the ÿ is a byte with value 255)
Sum of bytes is 2223, output is:
2 2 23 ./w