top | item 20896028

(no title)

petrikapu | 6 years ago

In Python

  >>> (-80538738812075974)**3 + 80435758145817515**3 + 12602123297335631**3
  42

discuss

order

stefan_|6 years ago

In Google:

    1.9892987e+35
It pains me how its 2019 and the fricking Google calculator is less powerful than a solar powered credit-card sized one from the 90s. A single chip made on the earliest imaginable IC processes can effortlessly deal with larger numbers than the lazy ignorant Google implementation. Maybe they can make this an interview question.

abdulhaq|6 years ago

Most calculators of that era had a maximum number Of digits between 8 and 12. Perhaps the Hp48 could do this calculation but not any of the credit card calcs.

antoineMoPa|6 years ago

In bash

  $ echo "print((-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3)" | sed "s/\^/**/g" | python -
  42

Franciscouzo|6 years ago

You're just using python, using bc is more bashy:

    $ echo '(-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3' | bc
    42

saagarjha|6 years ago

Without shelling out:

  $ echo $(((-80538738812075974)**3 + 80435758145817515**3 + 12602123297335631**3))
  42

hazeii|6 years ago

In calc:

$ calc

calc 2.12.4.1

> (-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3

        42
>

Literally pasted off the web page and verified in a couple of seconds.

wruza|6 years ago

One more proof that you can do everything in bash.

zests|6 years ago

In dc/shell/bash

       dc -e '_80538738812075974 3 ^ 80435758145817515 3 ^ 12602123297335631 3 ^ + + p'

taneliv|6 years ago

In SQL: SELECT (-80538738812075974::NUMERIC)^3 + 80435758145817515::NUMERIC^3 + 12602123297335631::NUMERIC^3;

harryh|6 years ago

In Scala:

  scala> BigInt("-80538738812075974").pow(3) + BigInt("80435758145817515").pow(3) + BigInt("12602123297335631").pow(3)
  res0: scala.math.BigInt = 42

Fuhrmanator|6 years ago

In Pharo

  (-80538738812075974 raisedTo: 3)
 + (80435758145817515 raisedTo: 3)
 + (12602123297335631 raisedTo: 3)  "42"