• 1 Post
  • 492 Comments
Joined 1 year ago
cake
Cake day: August 24th, 2023

help-circle
  • haha nice. So the CPython’s math.sqrt just hands it off to the C/POSIX implementation of sqrt and even that could possibly be handing it off to the cpu for calculating the square root as fast as possible. my dumb binary search written in complete python is literally matching the speed of some of the most performant methods of doing square root.

    but you are right, my method of using a binary search isn’t outlandish at all! wow https://stackoverflow.com/questions/3581528/how-is-the-square-root-function-implemented
    infact it does seem similar to newton’s method. I just bypassed the entire calculating square root to get the root value and just simply searched for the first single digit integer that will contain the root(ie first and last valid positions)

    however as the comments to that solution alluded to, when it comes to precision, this method is not worth it. While for us, an approximation that is accurate enough to the single digits is really dam good and might be faster.(while it is not worth to implement for the general sqrt function, unless you know it is needed for extremely low precision tasks or as a challenge)

    I sat here thinking I was being dumb for reinventing the wheel lmao




  • Call it optimization and people will assume it is magic. Instead I call this a simple algebra challenge.(With part two having that quirky concatenation operation)

    It is like solving for x. Let’s take an example:

    3267: 81 40 27

    If you change it to equations:

    81 (+ or *) 40 (+ or *) 27 = 3267
    Which effectively is:
    81 (+ or *) 40 = x (+ or *) 27 = 3267

    So what is the x that either add or multiply would need to create 3267? Or solve for x for only two equations.
    x + 27 = 3267 -> x = 3267 - 27 = 3240
    x * 27 = 3267 -> x = 3267 / 27 = 121

    (Special note since multiplying and adding will never make a float then a division that will have a remainder(or float) is impossible for x, we can easily remove multiplying as a possible choice)

    Now with our example we go plug in x:
    81 (+ or *) 40 = (3240 or 121) (+ or *) 27 = 3267

    So now we see if either 40 or 81 can divide or subtract from x to get the other number. Since it is easier to just program to use the next number in the list, we will use 40.

    81 + 40 = 3240 -> x = 3240 - 40 = 3200 != 81
    81 * 40 = 3240 -> x = 3240 / 40 = 81
    81 + 40 = 121 -> x = 121 - 40 = 81
    81 * 40 = 121 -> x = 121 / 40 = 3.025 != 81

    This particular example from the website has two solutions.

    For the concatenation operation, you simply check if the number ends with the number in the list. If not then a concatenation cannot occur, and if true remove the number from the end and continue in the list.

    Call it pruning tree paths but it is simply algebraic.









  • I know this is a day old and most people who would have seen this already have moved on, but this is a simple fix. In fact if you have secure boot enabled, the Nvidia driver installation will detect it and start the signing process. If you don’t have secure boot enabled, then it will skip it. I think having secure boot enabled and properly signing your drivers is good to not end up in that situation again. Though I understand how annoying it can be too. Sigh








  • Yeah I feel as though he won’t get that amount of money either and making any money is also outrageous.

    I feel like the biggest pressing issue here is that this is not meant to go to the moon and stay there. Instead I think the real motive is to make inflation. Look at it, it’s not meant to gain that amount of value, it’s meant to skew our perception of value. This way the current inflationary prices don’t look out of place when, in reality, everything is over valued. I guess it is also meant to make some people more complacent to inflation by giving them hope of “there being a chance” even though it clearly details how screwed over most of them will end up in the end compared to the house/dealer. Gambling is and will always be a big problem that adds more pressure to an otherwise unhealthy economy.


  • My phone is starting to take better document pictures than my printer. Especially if I hold my phone steady at the right height. I bet if I used a 3D printer to create a stand to hold it for me. Heck I could buy a giant bucket or rack or whatever and bright high color index lights to further improve image clarity to ungodly levels. Still, the Samsung camera app with the AI features already being preloaded that will likely be improved in the next 5 years will just get better. Printers and scanners are completely a pita.