-3
\$\begingroup\$

is one of the tags on this site, representing challenges that test how much code is needed to output a given fixed result (usually a piece of text). The info page for this tag lists the string 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd as an example of a string with a high Kolmogorov complexity, stating that printing this string literally is probably the shortest way to output it. I would like to test this statement, and thus your challenge is to output this string, without using a literal representation of it.

Rules

  • You must write a full program that takes no input, and outputs exactly the result string, with a single optional trailing newline. Output may be in any format allowed by default IO rules (writing to STDOUT, writing to a file, displaying to the screen, etc)
  • No submitting the trivial solution of your language's equivalent of print "4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd", however, I will create a community wiki answer to list trivial solutions for comparison, so if you answer in a language not added to that answer, please edit that language's trivial solution (if it exists) into that post.
  • Use of built-ins is allowed, if your language somehow has a built-in that contains or can easily generate this string, I would love to see that.

, so lowest bytecount is best score, but please also list the difference in length between your bytecount and the bytecount of your language's trivial solution with your score.

\$\endgroup\$
8
  • 7
    \$\begingroup\$ What exactly counts as not a trivial solution? Hardcoding a list of codepoints and converting them to characters before printing? Is print "4c1j5b2p0cv4w1x8rx2y"+"39umgw5q85s7uraqbjfd" different enough to not be a trivial solution? Given that the string is chosen to have a high Kolmogorov complexity, I doubt it has any significant patterns that can be exploited, so every solution is likely to be some variation on hard-coding the string. \$\endgroup\$
    – DLosc
    Mar 23, 2022 at 22:07
  • \$\begingroup\$ @DLosc I would say a list of codepoints is not trivial, and there may even be some ways to represent that more compactly than a literal string, but concatenating string literals is no different from using one literal \$\endgroup\$
    – des54321
    Mar 24, 2022 at 0:18
  • 7
    \$\begingroup\$ It is my opinion that rule 2 is unclear and effectively un-enforcable. If this rule remains as is, I at least, will not be considering flags to delete invalid answers to this question. There is just no way to consistently and objectively judge whether an answer meets rule 2. \$\endgroup\$
    – Wheat Wizard
    Mar 24, 2022 at 0:35
  • 1
    \$\begingroup\$ The typical way of handling this is not to disallow trivial solutions, but just to discourage them, and make the community wiki answer. A hard rule is unclear (this is something that should have been brought up in the sandbox, sorry for that). \$\endgroup\$ Mar 24, 2022 at 1:43
  • 1
    \$\begingroup\$ @KevinCruijssen 31 bytes with normal base conversion \$\endgroup\$
    – ovs
    Mar 24, 2022 at 12:13

5 Answers 5

3
\$\begingroup\$

Jelly,  35  34 bytes

ØBḟØA“÷ȯḋ²÷Œmṗ)¿+¹ỊỴ7ĠYṖP0ṡẋœ{ỵC’ṃ

Try it online!

How?

ØBḟØA“...’ṃ - Main Link: no arguments
ØB          - base-62 digits = "0..9A..Za..z"
   ØA       - uppercase characters = "A..Z"
  ḟ         - filter-discard -> "0..9a..z"
     “...’  - big integer in a base 250 representation
          ṃ - base decompress (use the characters as base 62 digits of the integer)
            - implicit print
\$\endgroup\$
2
  • \$\begingroup\$ not bad! I did assume this sort of thing would be main thing I'd see for this question, built-in string compression from languages that can do that easily \$\endgroup\$
    – des54321
    Mar 24, 2022 at 0:20
  • \$\begingroup\$ This uses no built-in string compression, it uses two built-in literals (ØB and ØA) and a large integer. But, yes, I doubt you will get an answer that beats the purely trivial one that exploits a pattern in the data (since encoding that pattern is likely to be much longer than printing the data itself), unless that is also a built-in feature of the language itself (Bubblegum style). \$\endgroup\$ Mar 24, 2022 at 13:46
3
\$\begingroup\$

Trivial Solutions

If you answer this question and the trivial solution to this problem is not currently listed here, please edit it into this post, to serve as a point of comparison against non-trivial solutions in that language. For purposes of clarity, the trivial solution to this problem is defined as your language's equivalent of a print statement, plus your language's equivalent of a string literal, containing 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd, and being passed to the print statement, plus whatever boilerplate is necessary to make it a full program.

When adding a language to this, please format with a level three heading containing the language name and bytecount (formatting: ### Language Name, XX bytes ###). Follow this with a codeblock (formatting: ``` code here ```) containing the code of the trivial solution. Please try to keep the list in alphabetical order by language name.

Place solutions below this line:


05AB1E, 41 bytes

"4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd

Charcoal, 29 bytes

”E#-¡2e·ⅉÀθº,"GEσG>υ[C=↥↗μω⮌ψ

It's a compressed string literal, but it's still a string literal, so I guess this counts as a trivial solution. The link is to the equivalent Verbose Charcoal, which is an even more trivial solution, but the Charcoal deverbosifier helpfully prints the actual solution before executing it.

Java 8, 45 bytes

v->"4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd"

Jelly, 41 bytes

“4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd

Julia, 49 bytes

print("4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd")

Python 2, 47 bytes

print"4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd"

Python 3, 49 bytes

print("4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd")

Retina, 41 bytes


4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd

Rust, 61 bytes

fn main(){print!("4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd")}

APL, 42 bytes

'4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd'
\$\endgroup\$
2
\$\begingroup\$

Julia, 49 bytes

print(4,:c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd)

Try it online!

Same length as the trivial solution. I guess it's not trivial ? And it's technically not concatenation. It prints the number 4 and then a Symbol (technically not a string).

Feel free to debate whether this is too trivial or not

\$\endgroup\$
1
\$\begingroup\$

Charcoal, 36 bytes

⍘⍘AN%)~:0+VJEkbeQYeRX!$2_[^}8g?\xγ³⁵

Try it online! Explanation: Converts the literal string AN%)~:0+VJEkbeQYeRX!$2_[^}8g?\x from base 95 (using printable ASCII) to base 35 (using 0-9a-y).

If the compressed string literal form of the above literal string is allowed, then for 34 bytes:

⍘⍘“\`"Zζ﹪⊕↙84¤κq≡IT⁵⭆℅?R¤Bg÷φm⊙”γ³⁵

Try it online! Link is to verbose version of code.

Alternatively, the compressed string literal form of the numeric value of the base 35 conversion also results in 34 bytes:

⍘I”)¶&K‖◨"Sγ]ιJG÷φïzjμp⬤XχφωqE·”³⁵

Try it online! Link is to verbose version of code.

\$\endgroup\$
2
  • \$\begingroup\$ Both of these are longer than the Charcoal answer in the "trivial solutions" section. \$\endgroup\$ Mar 24, 2022 at 1:17
  • \$\begingroup\$ @TheFifthMarshal But they are still shorter than the Charcoal program 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd. I'm just not sure whether using built-in compression counts as trivial or not, so I'm erring on the side of safety and providing both options. \$\endgroup\$
    – Neil
    Mar 24, 2022 at 1:20
1
\$\begingroup\$

Vyxal, 35 34 bytes

»gtWŀż⌊l,∇ɖ∩꘍√ṘȮ∞*"Cβ1⋎ʀv@Ḃ»kakd+τ

Try it Online!

-1 thanks to @whqwert

Ez

»gtWŀż⌊l,∇ɖ∩꘍√ṘȮ∞*"Cβ1⋎ʀv@Ḃ»kakd+τ # Full program
                                 τ # Convert the number to base len(str) using the number...
»gtWŀż⌊l,∇ɖ∩꘍√ṘȮ∞*"Cβ1⋎ʀv@Ḃ»       # 149288472330050833510329217157030174401240445325930074868876423
                            kakd+  # And the string "abcdefghijklmnopqrstuvwxyz0123456789"
\$\endgroup\$
1

Not the answer you're looking for? Browse other questions tagged or ask your own question.