16
1
Given a nonnegative integer n
, your solution must output a program in your chosen language whose output has n
times as many bytes as the outputted program.
Rules
- You must specify the language and encoding of the programs your solution outputs, and you may not choose different languages or encodings for different inputs to your solution. The language of your output program may or may not be the same as the language of your solution.
- Your submission only needs to handle integers in your language's range, but please do not abuse this rule.
This is code-golf so the shortest submission in bytes wins.
Example
Suppose n
is 4. My solution then outputs f_8
, a program which, in my (imaginary) language outputs j3 1s+/2]!mz
. The program output has length 3 and its output has length 3 * 4 = 12, so the solution is correct for input 4.
Suppose instead that n
is 1 and my program outputs ffffpfpffp
(10 bytes). The program ffffpfpffp
in my chosen language would have to produce an output of 10 * 1 = 10 bytes.
At the moment, this is pretty underspecified. Could you provide some examples? – James – 2017-08-22T01:32:17.467
3I think I know what we're supposed to do, but every time I read the spec, I become less certain. output some text that has n times as many bytes as the outputted program seems to imply that we have to output a text and a program. The character set and the language must be consistent for all integers. Which "character set" is this referring to? – Dennis – 2017-08-22T01:49:57.153
Nevermind, I actually did misunderstand, and so did all but one of the answers. – Dennis – 2017-08-22T01:53:54.517
1@Dennis It doesn't help that the title seems to contradict the body. Perhaps Output a program that outputs n times its length would be a better title, if I understand the challenge correctly (I'm not sure I do) – Sisyphus – 2017-08-22T01:55:08.213
"A program in your chosen language whose output has n times as many bytes as the outputted program". On what input? I would guess given no input, but that should be explicit. – Peter Taylor – 2017-08-22T07:31:15.173
Can I use HQ9+ as the output language? (I think consensus allows that now) if so then a 3-byte solution would be trivial. – Erik the Outgolfer – 2017-08-22T07:55:47.110
What happens if the two languages use different code pages? – Neil – 2017-08-22T08:38:16.007
1Can we take
n
as a string? – Shaggy – 2017-08-22T11:19:33.507