5
\$\begingroup\$

Write an irreducible proper quine, i.e. a program that prints its own source code, which can't be reduced by removing characters to a shorter program with the same constraints.

Eg. the python quine:

var='var=%r;print(var%%var)';print(var%var)

can be reduced to the quine

v='v=%r;print(v%%v)';print(v%v)

thus it is not irreducible, although the program below is.

Standard Loopholes apply, this and this in particular.
The longest answer wins.

\$\endgroup\$
1
  • \$\begingroup\$ Sandbox \$\endgroup\$
    – math scat
    Commented Dec 12, 2023 at 12:42

6 Answers 6

5
\$\begingroup\$

Vyxal, \$10↑↑256.654\$ bytes

...W:k⟇Cƒeε\‹*`k⟇Cƒe`$+∑$C∑+

The exponentiation tower part of the byte count is the result of evaluating k⟇Cƒe, which is equal to reducing the character codes of each character in the vyxal codepage by **.

The number is too large to compute, but an expression can be found here.

Replace the ... with k⟇Cƒe followed by \$955^{411^{172^{...}}}\ - \text{chr}(x)\$ s for x in W:k⟇Cƒeε\‹*k⟇Cƒe$+∑$C∑+.


The idea here is this base quine:

87 58 51 50 67 106 36 67 8721 43W:32Cj$C∑+

It's been modified to have the numbers be replaced with decrementing that big power tower each time.

Irreducibility

Removing any character from k⟇Cƒe fails to push a number, and starts performing unexpected behaviour. Removing any of the s fails to decrement the number adequately.

\$\endgroup\$
1
  • \$\begingroup\$ In up arrow notation, the number in the link is 10↑↑256.654 \$\endgroup\$ Commented Mar 26 at 2:22
3
\$\begingroup\$

Mathematica, at least 10↑↑1,048,580.82 bytes

⍰=15005630095464434488058966945142;Print[FromCharacterCode[List@@(97→61)],a,FromCharacterCode[59],FromCharacterCode[IntegerDigits[⍰,Nest[Hyperfactorial,$OutputSizeLimit,$OutputSizeLimit]]]]

Where ⍰ is U+10FFFF, the biggest Unicode character recognized by Mathematica

Try a smaller version of it online!

Where the number is FromDigits[ToCharacterCode["Print[Everything inside the print]"], Nest[Hyperfactorial,$OutputSizeLimit,$OutputSizeLimit]]]. The key here is that the "→" is character code 62754. The ⍰ means the base of the number can't drop below 1114111. I believe Hyperfactorial to be the fastest growing function. $OutputSizeLimit is the largest built-in integer constant that I could find under 1114111, at 1048576 (2↑20).

I went through a few iterations, first using Nest[...,11,9] then Nest[...,4,11], but any constant less than 1114111 would fit, so $OutputSizeLimit is the biggest. There might be some constant in the Astronomical or Element data that fits between 1048576 and 1114111, but $OutputSizeLimit is pretty close.

Ω(Log10[Hyperfactorial[x]]) is x, where Ω is lower bound notation. It's really closer to x2, but compared to the power of logarithms, they may as well be the same. This means that Hyperfactorial of 1114111 nested x times is at minimum (10)↑↑(x+1).

Edit, change a to a very high unicode character. One letter variable are hard to remove, so it should be irreducible. Updated $JavaAddSizeLimit to $OutputSizeLimit to fit as such.

\$\endgroup\$
2
\$\begingroup\$

Jelly, 80841 bytes

[…]ẈỌv 

Try it online!

A full program that is a quine.

The above is actually a list of lists of zeros with the following lengths: [7806, 59, 8318, 7816, 7884, 59, 8318, 118, 32]. These are then converted to Unicode code points which encode the following: Ṿ;⁾ẈỌ;⁾v

This is then called with the original list of lists of zeros as its argument. This code unevals the list and appends two two character strings that consist of the bit outside of the list. Note the space at the end of the program (and the last 32 byte member of the list) is needed because of nesting two-character strings within the main string. ( would terminate the string.)

\$\endgroup\$
2
\$\begingroup\$

Charcoal, 7200285678457 bytes

≔...θ´≔θθ⍘Lθ´L´⍘´≔´´´θ

... represents 7200285678438 ´s. No online link for obvious reasons. Explanation:

≔...θ

Assign 3600142839219 ´s to the variable. (´ is Charcoal's quote character, so it needs to be doubled to quote itself.)

´≔

Output the literal string .

θθ

Output two copies of the 3600142839219 ´s.

⍘Lθ´⪫´L´⍘´≔´´´θ

Convert 3600142839219 to base 5 using a custom character set, so instead of resulting in 432441043031323334 you get θ´≔θθ⍘Lθ´L´⍘´≔´´´θ.

\$\endgroup\$
2
\$\begingroup\$

Python, 10↑↑4.6290 bytes

⍰=len("aaaaaa...aaaaaaa")
def a(b,c):
 d=[]
 while b:
  d.append(b%c)
  b//=c
 return d[::-1]
def e(b):return b<<b
print(f"⍰=len({"a"*⍰})")
print(bytes(a(⍰,e(201546))).decode())

Where ⍰ is U+3134A (201546), the biggest single-variable character in python, found with

for i in range(0x10FFFF, 1, -1):
    try:
        exec(f"{chr(i)}=1")
        print(f"{i}={hex(i)}={chr(i)}")
        break
    except SyntaxError:
        pass

Where the number of 'a's length is converted from decimal, to a list of numbers in base e(201546). If you remove the e(), then you can't output the ⍰.

10^e(201546)^151
= 10^(201546*2^201546)^151
= 10^(201546^151*2^201546^151)
~ 10^^4.462896
\$\endgroup\$
2
  • \$\begingroup\$ Can you remove the int( ) call? \$\endgroup\$ Commented Apr 2 at 17:11
  • \$\begingroup\$ @noodleman Yes! I can since every number is an integer, the mod function will only ever return integers, making the int() call redundant. Updated. \$\endgroup\$ Commented Apr 2 at 22:49
1
\$\begingroup\$

Java 7, 172 bytes

class M{public static void main(String[]a){String s="class M{public static void main(String[]a){String s=%c%s%1$c;System.out.printf(s,34,s);}}";System.out.printf(s,34,s);}}

Takes advantage of the Java version to make things as long as possible.
In Java 8+ you can shorten class M{public static void main to interface M{static void main; in Java 10+ you can shorten String s= to var s=; and in Java 5 and 6 you can shorten class M{public static void main(String[]a){ to enum M{M;{ by abusing a bug.

Try it online. (This TIO uses Java 8, but in Java 7 it's irreducible.)

Explanation:

class M{                 // Class
  public static void main(String[]a){
                         //  Mandatory main method
    String s=            //   String `s`, containing:
      "class M{public static void main(String[]a){String s=%c%s%1$c;System.out.printf(s,34,s);}}";
                         //   the source code, where the `""` are replace with `%c%s%1$c`
    System.out.printf(s, //   Print String `s` with formatting:
      34,                //    Where the `%c` and `%1$c` are replaced with `"` (codepoint 34)
      s);}}              //    and `%s` is replaced with String `s`
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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