0
\$\begingroup\$

Write code that outputs the smallest integer \$n > 5\$ such that \$\frac{\sqrt{\log_2{n}}}{(\log_2 {\log_2 n})^2} > 1\$. Your code may have at most one digit in its source code. You can use your chosen digit more than once however.

By digits we are only counting the ASCII characters between 0x30 and 0x39 (inclusive).

\$\endgroup\$
8
  • \$\begingroup\$ @Dingus I had the bound wrong for \$n\$. Fixed now. Thank you. \$\endgroup\$
    – Simd
    Commented Dec 9, 2023 at 9:31
  • 4
    \$\begingroup\$ What counts as a digit? \$\endgroup\$
    – Neil
    Commented Dec 9, 2023 at 12:27
  • 3
    \$\begingroup\$ By digits are we only counting the ASCII characters between 0x30 and 0x39 (inclusive) or any character that resembles a digit? For example, is ⁹²2*‘ a valid Jelly solution? \$\endgroup\$ Commented Dec 9, 2023 at 14:04
  • 1
    \$\begingroup\$ @NickKennedy I think that's valid \$\endgroup\$
    – Simd
    Commented Dec 9, 2023 at 15:10
  • 1
    \$\begingroup\$ The value is equal to ackermann(4, 2) + 4. \$\endgroup\$
    – Bubbler
    Commented Dec 10, 2023 at 23:44

17 Answers 17

16
\$\begingroup\$

Python, 22 bytes

print(-~2**2**2**2**2)

Attempt This Online!

According to WolframAlpha, the equation \$\sqrt{\log_2(x)} = \log_2(\log_2(x))^2\$ has three solutions. Two real numbers around 1 and 5 and a very large integer solution. So what is that large integer solution?

Simple transformations on both sides yield $$ \log_2(x)^{\frac 1 4} = \log_2(\log_2(x)) \\ 2^{2^{log2(x)^{1/4}}} = x $$ Now, substitute \$y=\log_2(x)^{1/4}\$. Note that \$y\$ has to be an integer as well. This yields two equations: $$ 2^{2^y} = x, \quad y=\log_2(x)^{\frac 1 4} \\ 2^{2^y} = x, \quad y^4=\log_2(x) \\ 2^{2^y} = x, \quad 2^{y^4}=x \\ 2^{2^y} = 2^{y^4} \\ 2^y = y^4 \\ $$

The only integer solution to this is \$y=16\$, leaving us with \$x=2^{16^4}=2^{2^{2^{2^2}}}\$. The first integer that satisfies the inequality is \$x+1\$.

\$\endgroup\$
1
  • \$\begingroup\$ Doh! I'll delete... \$\endgroup\$
    – aeh5040
    Commented Aug 22 at 20:48
7
\$\begingroup\$

R + gmp, 25 bytes

gmp::as.bigz(2)^2^2^2^2+T

Try it at RDRR!

Port of @ovs’ Python answer, so be sure to upvote that one too! R has no native bigint support so this needs the gmp package.

\$\endgroup\$
6
\$\begingroup\$

Vyxal, 29 bitsv2, 3.625 bytes

k₴E›

Try it Online!

Bitstring:

10000100001000010110011010000

Port of the python answer, but without any digits at all.

Explained

k₴E›­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌­
k₴E   # ‎⁡2 ** 65536
   ›  # ‎⁢+ 1
💎

Created with the help of Luminespire.

\$\endgroup\$
6
\$\begingroup\$

JavaScript (Node.js), 21 bytes

-1 thanks to @l4m2

The only (decimal) digit used in the source is 0.

_=>-~(-~0n>>~0xFFFFn)

Try it online!

This computes \$1+2^{1+65535}\$


With all the BigInt suffixes and extra parentheses due to a different operator precedence, a direct port of ovs' answer would be 25 bytes:

_=>-~(2n**2n**2n**2n**2n)

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ <<-~0xFFFFn => >>~0xFFFFn \$\endgroup\$
    – l4m2
    Commented Dec 9, 2023 at 12:20
6
\$\begingroup\$

Wolfram Language(Mathematica), 13 12 bytes

12 bytes version, provided by @att

Try it online!

+++2^2^2^2^2

13 bytes version. Try it online!

2^2^2^2^2+2/2
\$\endgroup\$
1
  • 1
    \$\begingroup\$ prefix +++ instead of +2/2 for -1 \$\endgroup\$
    – att
    Commented Aug 18 at 19:41
5
\$\begingroup\$

Charcoal, 8 bytes

I⊕X²X⁴¦⁸

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

   ²        Literal integer `2`
  X         Raised to power
     ⁴      Literal integer `4`
    X       Raised to power
       ⁸    Literal integer `8`
 ⊕          Incremented
I           Cast to string
            Implicitly print

10 bytes using only one superscript digit:

I⊕X²X⊗²⊗⊗²

Try it online! Link is to verbose version of code. Explanation: As above, but uses Doubled () to make 4 and 8 from 2. (A port of @ovs' Python solution would have been 12 bytes.)

\$\endgroup\$
3
\$\begingroup\$

Jelly, 5 bytes

⁹²2*‘

Try it online!

Port of @ovs’ Python answer, so be sure to upvote that one too! The superscript digits are permitted as per reply to comment from @Simd (the OP).

Explanation

⁹     | 256
 ²    | Squared
  2*  | 2 to the power of this
    ‘ | +1
\$\endgroup\$
3
\$\begingroup\$

Japt, 11 bytes

Japt has no native BigInt support. Was stuck on 12 bytes (or worse) most of the morning before coming up with this.

ÒOx#î"2n**

Test it

ÒOx#î"2n**
Ò               :Negate the bitwise NOT of
 Ox             :  Eval as JavaScript
   #           :    18
     î"2n**     :    Repeat "2n**" to length 18
\$\endgroup\$
2
\$\begingroup\$

Haskell, 14 bytes

succ$2^2^2^2^2

Try it online!

Port of @ovs python answer

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

Nekomata, 5 bytes

¥:*Ë→

Attempt This Online!

¥:*Ë→
¥       Push 256
 :      Duplicate
  *     Multiply
   Ë    Power of 2
    →   Increment
\$\endgroup\$
2
\$\begingroup\$

dc, 12

2dddd^^^^z+p

Try it online!

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

Alice, 14 bytes

code with non ascii character

Try it online!

The trailing new line is required
I'm using a screenshot as the non ascii character gets removed on save

Port of lyxal's solution

Explanation:

2                Pushes 2 on the stack
 '0xFFFF         Pushes 65535 on the stack
   h             Increment the top of the stack
    E            Pop y, pop x, push x^y
     h           Increment the top of the stack
      / O @      Output and exit

Same byte count using Ā for \$256 * 256 = 65536\$

2'Ā.*Eh/ O @

Try it online!

\$\endgroup\$
5
  • \$\begingroup\$ Is one of 2 and 0 not an ASCII character? \$\endgroup\$
    – Simd
    Commented Dec 10, 2023 at 19:56
  • \$\begingroup\$ @Simd if you are referring to the 0xFFFF in the explanation, I just use it as a placeholder to show the value of the unprintable character, otherwise the other O stands for Output \$\endgroup\$
    – Julian
    Commented Dec 10, 2023 at 19:58
  • \$\begingroup\$ Would 𐀀 work instead of h? (Same byte count though.) \$\endgroup\$
    – Neil
    Commented Dec 11, 2023 at 0:38
  • \$\begingroup\$ (I see what you mean about 0xFFFF being lost...) \$\endgroup\$
    – Neil
    Commented Dec 11, 2023 at 0:39
  • \$\begingroup\$ 𐀀 would not work, I do not think it is a valid Alice instruction. h increments the result by 1 as the desired output is the result of \$2^{65536}+1\$ \$\endgroup\$
    – Julian
    Commented Dec 11, 2023 at 1:46
2
\$\begingroup\$

05AB1E, 4 bytes

₁no>

Try it online.

Without using the superscript number(s) either, it's still 4 bytes:

žHo>

Try it online.

Explanation:

₁     # Push builtin 256
 n    # Square it to 65536

žH    # (or alternatively) Push builtin 65536

  o   # Pop and push 2 to the power this 65536
   >  # Increase it by 1
      # (which is output implicitly as result)
\$\endgroup\$
2
\$\begingroup\$

J, 9 bytes

>:^^:*~2x

Attempt This Online!

>:^^:*~2x
       2x    bigint 2
  ^^:*~      call ^^:* with 2x on both sides:
   ^:          repeat
  ^            2^ (2 is the left argument of ^:)
     *         2*2 times (the 2s are the left and right arguments of ^:)
             the result so far = 2^(2^(2^(2^(2))))
>:           increment

Bonus 10 and 11 bytes:

>:2x^*:#a.
        a.    a built-in string containing 256 extended ascii chars
       #      length of it (256)
     *:       square
  2x^         raise 2 to the power of that
>:            increment

>:^/2>.i:2x
       i:2x   -2 -1 0 1 2
    2>.       apply max(2, x) to each element; 2 2 2 2 2
  ^/          reduce by ^ from the right; 2^(2^(2^(2^(2))))
>:            increment
\$\endgroup\$
1
\$\begingroup\$

PowerShell Core, 32 bytes

code with non printable characters

Try it online!

Explanation:

                  1+0xFFFF[!1]     # Calculates 65536
[bigint]::pow(1+1,            )    # Calculates 2^65536
                               +1  # Increments by 1 and implicitly prints on stdout
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Amazing it has bigint support! \$\endgroup\$
    – Simd
    Commented Dec 10, 2023 at 20:39
1
\$\begingroup\$

sclin, 18 bytes

1 1+""S>c1+ ^1+

Try it on scline!

Didn't read the question closely x_x.

\$\endgroup\$
2
  • 4
    \$\begingroup\$ Your code may have at most one digit in its source code. You can use your chosen digit more than once however. Your code has 1, 2, 3, 5, 6. \$\endgroup\$
    – Bubbler
    Commented Dec 11, 2023 at 4:57
  • \$\begingroup\$ ah my bad, will edit \$\endgroup\$ Commented Dec 11, 2023 at 16:28
1
\$\begingroup\$

Raku (Perl 6) (rakudo), 16 bytes

say -+^2**2¹⁶

Attempt This Online!

\$\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.