15
\$\begingroup\$

easy mode of my previous challenge

A perfect number is a positive integer whose sum of divisors (except itself) is equal to itself. E.g. 6 (1 + 2 + 3 = 6) and 28 (1 + 2 + 4 + 7 + 14 = 28) are perfect.

A sublime number (OEIS A081357) is a positive integer whose count and sum of divisors (including itself) are both perfect. E.g. 12 is a sublime number because:

  • the divisors of 12 are 1, 2, 3, 4, 6, 12
  • the count of divisors is 6 (perfect)
  • the sum of divisors is 28 (perfect)

The next smallest known sublime number is

6086555670238378989670371734243169622657830773351885970528324860512791691264

which is a product of a power of 2 and six Mersenne primes

$$ 2^{126}(2^3-1)(2^5-1)(2^7-1)(2^{19}-1)(2^{31}-1)(2^{61}-1) $$

These two numbers are the only known sublime numbers as of 2022. The necessary and sufficient conditions for even sublime numbers have been found in this paper (pdf), but it remains unknown whether odd sublime numbers exist.

It is known that there are no other even sublime numbers before the number, but it is not known whether there are any odd ones.

Task

Output the second even sublime number shown above. It is OK to only theoretically output this number in the following ways:

  • the program outputs the correct number with probability 1 in finite time
  • the program outputs the correct number given enough time and unlimited memory
  • the program would output the correct number if the native number type had infinite precision

Standard rules apply. The shortest code in bytes wins.

\$\endgroup\$
6
  • \$\begingroup\$ @thejonymyster It is known that there are no other even sublime numbers below that number. \$\endgroup\$
    – Bubbler
    Aug 26 at 1:10
  • \$\begingroup\$ So... I'm wondering that... Is there any built-in in Mathematica output this? \$\endgroup\$
    – tsh
    Aug 26 at 6:36
  • \$\begingroup\$ ///, 76 bytes, optimal solution: 6086555670238378989670371734243169622657830773351885970528324860512791691264 \$\endgroup\$ Aug 26 at 17:19
  • \$\begingroup\$ "the program outputs the correct number with probability 1 in finite time": do you mean to imply as well that there is no other output? \$\endgroup\$ Aug 27 at 0:50
  • \$\begingroup\$ @GregMartin I think other output will be considered a loophole. See codegolf.meta.stackexchange.com/a/9447/55372 \$\endgroup\$
    – pajonk
    Aug 28 at 10:57

17 Answers 17

7
\$\begingroup\$

PARI/GP, 45 bytes

print(vecprod([4^i-2^i|i<-[3,5,7,19,31,61]]))

Attempt This Online!

The number is \$\prod_{i\in\{3,5,7,19,31,61\}}(4^i-2^i)\$. In fact, \$126=3+5+7+19+31+61\$.

Another interesting fact is that \$2^{126}\$ is just the sum of divisors of \$\prod_{i\in\{3,5,7,19,31,61\}}(2^i-1)\$. This might be useful for some golfing language if there is a built-in for divisor sum.

\$\endgroup\$
5
\$\begingroup\$

Python 2, 37 bytes

print~-2**31*~-2**61*14448825433<<126

Try it online!

Writes out \$2^{31}-1\$, \$2^{61}-1\$, and the bit-shift \$2^{126}\$, and hardcodes the remaining product.

\$\endgroup\$
5
\$\begingroup\$

R, 33 32 bytes

Edit -1 byte thanks to @xnor.

prod(8^42,2^c(3,5,7,19,31,61)-1)

Try it online!

Spells out the product.

@alephalpha's approach leads to +1 byte for me (see the footer of the TIO link above).

\$\endgroup\$
2
  • \$\begingroup\$ You can do 8^42 for 2^126 \$\endgroup\$
    – xnor
    Aug 26 at 4:36
  • \$\begingroup\$ @xnor ah, right, thanks! \$\endgroup\$
    – pajonk
    Aug 26 at 6:24
5
\$\begingroup\$

05AB1E, 13 11 bytes

•w4н•foD<*P

-2 bytes thanks to @alephalpha.

Try it online.

Explanation:

•w4н•        # Push compressed integer 3772545
     f       # Get its prime factors: [3,5,7,19,31,61]
      o      # Get 2 to the power for each of these integers
       D     # Duplicate the list
        <    # Decrease each by 1 in the copy
         *   # Multiply the values at the same positions in the two lists
          P  # Get the product of this list
             # (after which the result is output implicitly)

See this 05AB1E tips of mine (section How to compress large integers?) to understand why •w4н• is 3772545.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ -2 bytes: •w4н•foD<*P \$\endgroup\$
    – alephalpha
    Aug 26 at 8:28
  • \$\begingroup\$ @alephalpha Ah, of course. Thanks! :) \$\endgroup\$ Aug 26 at 8:32
4
\$\begingroup\$

Vyxal, 14 13 11 bytes

»;⟑L»ǐE:‹*Π

Try it Online!

-1 byte thanks to alephalpha and -2 bytes thanks to Mukundan314.

Jelly, 17 16 bytes

“¤¦¬Œþ=‘2*’æ«21P

Try it online!

-1 byte thanks to xnor.

\$\endgroup\$
6
  • \$\begingroup\$ Might it be shorter to multiply each list element by 2^21 instead of the bit-shift at the end? \$\endgroup\$
    – xnor
    Aug 26 at 1:19
  • \$\begingroup\$ @xnor It's 2^126, and it's longer (“¤¦¬Œþ=‘2*’P×2*126¤) \$\endgroup\$
    – Steffan
    Aug 26 at 1:35
  • \$\begingroup\$ I meant to multiply each element of [7, 31, 127, 524287, 2147483647, 2305843009213693951] by 2^21 (probably via bit-shift) so that when we take their product, we've included an overall factor of (2^21)^6=2^126. \$\endgroup\$
    – xnor
    Aug 26 at 1:42
  • \$\begingroup\$ Ah, clever. That saves a byte on the Jelly answer (not on Vyxal because 126 could be compressed). Thanks! \$\endgroup\$
    – Steffan
    Aug 26 at 1:44
  • \$\begingroup\$ -1 byte for Vyxal. \$\endgroup\$
    – alephalpha
    Aug 26 at 2:51
4
\$\begingroup\$

Factor + math.unicode,  40 38 bytes

4 2 [ "=">array n^v ] bi@ v- Π .

Try it online!

-2 bytes from porting @alephalpha's PARI/GP answer.

Note "=" is a literal string that is equivalent to { 3 5 7 19 31 61 }. You can only see the = since the rest are non-printable, but you can see the non-printable characters on TIO. This needs to be converted to an array because n^v is buggy otherwise. Still 4 bytes shorter than the sequence literal.

  • 4 2 [ ... ] bi@ Apply [ ... ] to both 4 and 2.
  • { 3 5 7 19 31 61 } n^v Input raised to 3, input raised to 5, etc.
  • v- Subtract two vectors.
  • Π Take the product.
  • . Print the result to stdout.
\$\endgroup\$
4
\$\begingroup\$

Pyth, 20 19 16 15 bytes

*FsmtB^2dPC"9

Try it online!

*FsmtB^2dPC"9
          C"9  # compressed 3772545
         P     # prime factors (3, 5, 7, 19, 31, 61)
   mtB^2d      # map d: [2**d, 2**d - 1]
  s            # flatten
*F             # reduce on multiplication

-3 bytes thanks to @CursorCoercer
-1 byte thanks to @isaacg

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Save 3 bytes by replacing .U*bZ with *F \$\endgroup\$ Aug 26 at 16:18
  • 1
    \$\begingroup\$ Save 1 byte by replacing m-^4d^2d with smtB^2d \$\endgroup\$
    – isaacg
    Aug 28 at 0:52
3
\$\begingroup\$

Bash, 47 Bytes

echo "14448825433*(2^31-1)*(2^61-1)*(2^126)"|bc

Try it online!

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

Wolfram Language (Mathematica), 32 bytes

8^42##&@@(2^{3,5,7,19,31,61}-1)&

Try it online!

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

Charcoal, 21 bytes

IΠEX²⁻E357COm℅ι⁴⁸×ι⊖ι

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

       357COm           Literal string `357COm`
      E                 Map over characters
              ι         Current character
             ℅          ASCII code
     ⁻                  Vectorised subtract
               ⁴⁸       Literal integer `48`
   X                    Vectorised exponentiate with base
    ²                   Literal integer `2`
  E                     Map over powers of `2`
                    ι   Current power of `2`
                   ⊖    Decremented
                 ×      Multiplied by
                  ι     Current power of `2`
 Π                      Take the product
I                       Cast to string
                        Implicitly print
\$\endgroup\$
2
\$\begingroup\$

MathGolf, 15 bytes

357HT╟)]ó_(m*ε*

Try it online.

Explanation:

3        # Push 3
 5       # Push 5
  7      # Push 7
   H     # Push 19
    T    # Push 31
     ╟   # Push 60
      )  # Increase the 60 by 1
       ] # Wrap the stack into a list: [3,5,7,19,31,61]
ó        # Calculate 2 to the power each of these integers
 _       # Duplicate the list
  (      # Decrease each by 1
   m*    # Multiply the values at the same positions in the lists together
     ε*  # Product: reduce by multiplication
         # (after which the entire stack joined together is output implicitly as result)
\$\endgroup\$
2
\$\begingroup\$

MATL, 21 19 18 14 bytes

3772545YfWtqhp

Try it online!

3772545YfWtqhp
3772545Yf         # Prime factorize 3772545 (3, 5, 7, 19, 31, 61)
         W        # 2 ** elements
          t       # duplicate list
           q      # decrement elements in copy by 1
            h     # concatenate lists 
             p    # product

-2 bytes thanks to @Luis Mendo

\$\endgroup\$
0
2
+100
\$\begingroup\$

Prolog (SWI), 51 bytes

Thanks JoKing and Steffan for helping me golf some bytes

?-X is(2^61-1)*14448825433*(2^31-1)*2^126,write(X).

Try it online!

My very first Prolog answer :D, probably can be golfed a lot though.

\$\endgroup\$
4
  • \$\begingroup\$ you can just do write(X). \$\endgroup\$
    – Steffan
    Sep 2 at 1:02
  • \$\begingroup\$ also you can change X is 14448825433*(2^61-1) to X is(2^61-1)*14448825433 to save a byte. unfortunately it's the same length to use format: ?-format("~d",(2^61-1)*14448825433*(2^31-1)*2^126). \$\endgroup\$
    – Steffan
    Sep 2 at 1:02
  • \$\begingroup\$ @Steffan ah ok didn't know that, will fix \$\endgroup\$
    – Aiden Chow
    Sep 2 at 1:02
  • \$\begingroup\$ @Steffan ok that format trick is cool \$\endgroup\$
    – Aiden Chow
    Sep 2 at 1:04
1
\$\begingroup\$

Python, 49 bytes

Calculated (2^3−1)(2^5−1)(2^7−1) and (2^19-1) by hand, to reduce bytes.

print(2**126*7*31*127*524287*(2**31-1)*(2**61-1))
\$\endgroup\$
1
  • 3
    \$\begingroup\$ There are some more easy golfs, which will lead to basically xnor's solution. \$\endgroup\$
    – Bubbler
    Aug 26 at 6:22
1
\$\begingroup\$

Burlesque, 33 bytes

{Jfc~]++==}s1r1f{fcsa%1!j++%1!&&}

Try it online!

Given infinite time, should find sublime numbers

{    # IsPerfect function
 J   # Duplicate
 fc  # Factors
 ~]  # Without self
 ++  # Sum
 ==  # Equals self
}s1  # Store as "1"
r1   # Range 1..inf
f{   # Filter
 fc  # Factors
 sa  # Non-destructive Length
 %1! # IsPerfect
 j++ # Sum of factors
 %1! # IsPerfect
 &&  # And
}
\$\endgroup\$
1
\$\begingroup\$

Vyxal, 16 13 bytes

₆¨*≬K₍L∑¨=∆Kc

Try it Online!

half-Legitimate calculation is was shorter than hard coding lol. Given enough time and memory, this would eventually output the right number.

Explained

₆¨*≬K₍L∑¨=∆Kc
₆¨*≬        c   # From all multiples of 64 (which contains the target number), get the first where:
    K₍L∑        #   The list [len(factors), sum(factors)]
        ¨=∆K    #   Is invariant under sum of proper divisors
\$\endgroup\$
4
  • \$\begingroup\$ If the code means "last of the first two integers that are sublime", it isn't correct because there might be an unknown odd sublime number before the 2nd even one. \$\endgroup\$
    – Bubbler
    Aug 26 at 0:38
  • \$\begingroup\$ @Steffan That was exactly the initial version of this answer and my first comment explains why it doesn't work. \$\endgroup\$
    – Bubbler
    Aug 26 at 1:01
  • 1
    \$\begingroup\$ You could speed things up slightly by replacing with , because the target number is a multiple of 256. \$\endgroup\$
    – Steffan
    Aug 26 at 1:02
  • \$\begingroup\$ It's no longer shorter than hardcoding it :P \$\endgroup\$
    – Steffan
    Aug 26 at 3:13
1
\$\begingroup\$

Jelly, 12 bytes

⁹Æs;ÆdÆṣƑƲ1#

A full program that will (eventually!) print the result.

Don't Try it online!
The starts the search at 256, if one replaces it with 1 it'll find 12 - try that here.


Faster in 13:

“;Y,’Æf2*×’$P

Try it here.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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