9

If you want a really obtuse method for inverting numbers in python, here you go:

z0 = Decimal('78.56341431805592768684300246940000494686645802145994376216014333')

z1 = Decimal('1766612.615660056866253324637112675800498420645531491441947721134')

z2 = Decimal('1766891.018224248707391295083927186110075710886547799081463050088')

z3 = Decimal('15658548.51274600264911287951105338985790517559073271799766738859')

z4 = Decimal('1230189034.426242656418217548674280136397763003160663651728899428')

z5 = Decimal('1.000157591178577552497828947885508869785153918881552213564806501')

((((z0/(z1/(z2/(n)))))*(z3))/z4)/z5

From what I can see, it works for any value of n.

I have no clue why it works.

Also have a function to generate the z values for any n input.

Shitpost studios.

Bringing you QUALITY math posts since 2019!

"we shitpost because we care."

Comments
  • 6
    This is just a shitpost with wrong tag
  • 8
    It's equivalent to 0.99999..../n, what's surprising about it?
  • 3
    It's basically this
    (z0*z2*z3)/(z1*z4*z5*n)
    I bet that those numbers add up to 1.
  • 2
    Also using so much division is stupid beyond any measure.
  • 3
    You way overuse parentheses, and the only thing you _don't_ use them for is to fix is the multilevel fraction.
  • 2
    @theabbie "This is just a shitpost with wrong tag"

    How do you know me so well?
  • 1
    @iiii "Also using so much division is stupid beyond any measure."

    Clearly its the work of xanax.
  • 3
    @Wisecrack I mean that division is the most expensive operation which brings the most amount of rounding errors
  • 1
    @iiii It's like eating turkey with that cheap gold spray paint all over it. Why?

    Because we can.
  • 2
    I don't get what it is supposed to achieve. What do you mean by "inverting numbers" ?
  • 2
    What are you even trying to do if you end up with this
  • 2
    Not entirely a shit post.
    For those who don't get it. When you invert a number, Its bit get swapped hence resulting to the opposite value of it.

    Example:
    let Age = 12;
    // 12 in binary is =>>> 1100
    // when inverted is => 0011
    let invAge = invert(Age);

    // Hence Inverted Age (invAge) will equal 3

    The Use-case:
    There are a couple of scenarios where this might be helpful. One would be to have a numerical similarity measure that quantifies how close two lists are to each other. So, for example, Let's say we have two lists that contain some products with two different people and a rank beginning from the top-ranked to the least-ranked. From these two lists, We can then calculate inversions which would quantify how similar/dissimilar these two people are to one another making filtration faster.

    @Wisecrack called the given method of generating an inverted number a shit post cus the solution was hard coded rather than implementing a functional logic even if it works.
  • 1
    @GiddyNaya Which number is inverted here ? n ?
  • 0
    @pipe Yes it seems.
  • 4
    @GiddyNaya The simplification of that expression is (z0×z2×z3)/(z1×z4×z5×n), and since z0×z2×z3 = z1×z4×z5, the whole expression is just equal to 1/n (and that's why it works for any n).
    It mathematically inverts n, indeed, but with a lot of useless computation (so that may still be a shitpost overall). I doubt it also inverts its binary representation though.
  • 2
    Clearly well past the Ballmer peak. Now go write some fun commit messages and push to master it’ll be fun 😃
  • 0
    @electrineer
    "What are you even trying to do if you end up with this"

    Don't play coy. You know the game and so do I.
  • 0
    @pipe just returns 1/n.
  • 1
    @GiddyNaya I'm just gonna go with your explanation. Yep, that was definitely what the goal was.
  • 0
    @pipe Yes.
    Returns 1/n
  • 0
    @demoralizeddev completely sober but completely insane too.
Add Comment