Posts

Showing posts from March 25, 2019

Just Twice Is Nice

Image
4 0 $begingroup$ Let's have string multiplication to take a string and a positive number and concatenate that string that many times. In Haskell: 0 * s = "" n * s = s ++ ((n - 1) * s) Your task is to write a program that outputs a number $n > 0$ . When you double your program (with the described procedure) the new program should output $2n$ . When your program is tripled or quadrupled it should once again output the original $n$ . This is code-golf so your answers will be scored in bytes with fewer bytes being better. Related, Related. code-golf source-layout share | improve this question asked Dec 20 '18 at 21:03