Amazon is running a Prime Day sale on July 16 and 17. Setting aside the fact that this is two separate days, neither 716 nor 717 are prime numbers. They should’ve done 7/19 instead.

  • FeatherConstrictor@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    4 months ago

    Oh awesome that’s a neat trick I’ve never seen before. How does that work? For a number like 700 for example, 7 + 0 + 0 = 7 but 700 is visible by 10.

    • derpgon@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      It works differently for each number. For 2, the last number has to be divisible by 2. For 3, the sum of the digits has to be divisible by 3 For 5, the number has to end with a 0 or a 5. For 7, it is kinda tricky. Take the last digit, double it, and subtract it from the numbers on the left. If the remainder is 0 or divisible by 7, the whole number is divisible by 7. For example 49: 9×2=18, 4-18=-14, -14/7=2 with remainder 0. For 700, 0×2=0, 70-0=70, 70/7=10 remainder 0.

      This is usually specified for prime numbers, for non-prime number, you just do calculate the prime components of a number and combine the rules.

      For example, divisibility by 15: it has to be divisible by 3 and 5. 1+5=6, 6/3=2 remainder 0. 15 ends with a 5. For number where with multiple same prime components the rules for these duplicate numbers have to apply multiple times. Like for 25, it has to end with a 5 or 0, and when dividing the number by 5, the result has to end with a 5 or a 0 aswell.

      • FeatherConstrictor@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        😂 I’m familiar with many of them because I liked math in school and went through all of primary and middle school without a digital calculator. This one is one I hadn’t heard of before and, again because I like math, I’m interested in understanding 1) what the trick is and 2) mathematically how it works out