Digit Sum Simulation

Home Community Questions & Answers Mental Math Q & A Digit Sum Simulation

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27724
    neuman.akiva@yahoo.com
    Participant
    • Topics: 1
    • Replies: 1

    Hi,

    I am a student starting to study computer science, and decided to create a function that finds all the correct and incorrect digit sums within a specified range.  When I ran the function for the first hundred numbers I found that there were far more incorrect digit sums than correct ones.  Given that the accuracy of the digit sum is 90%, please explain this finding.  The following file contains the function, DS.ipynb

    Thank you,

    Akiva Neuman

    #27739
    Abhishek R
    Keymaster
    • Topics: 0
    • Replies: 73

    Hi Akiva,

    The denominator in your code does not include cases where the DS method correctly predicts a calculation as incorrect.

    I have updated your code to reflect this and you can find the notebook here: https://github.com/abhivr/public_repo/blob/main/Digit_Sum_Checker.ipynb

    When I wrote the book & created the course, I estimated the accuracy of the DS method using simple probability.

    The digit sum can only be a number between 1 to 9. So there are 9 possible values.

    8 of these 9 possible DS values will help you catch an error in the calculation without an issue.

    One out of these 9 possible values is the DS of the correct answer but it can also be the DS of the incorrect answer.

    So there are actually a total of 10 possible values for the Digit sum (9 Correct DS + 1 Incorrect DS) with one number repeating in Correct DS and Incorrect DS.

    So 9 / 10 (90%) the DS method correctly predicts the calculation as incorrect & correct. But 1/10 times the DS method predicts the calculation is correct when it is actually incorrect.

    Hope this clarifies.

    #27743
    neuman.akiva@yahoo.com
    Participant
    • Topics: 1
    • Replies: 1

    Right, I originally had the final condition as just an else statement and got 10% for the percentage of incorrect digit sums, but then thought that the else statement alone would be including too many situations such as where the digit sums are not equal and the third iterator number and the actual sum were not equal, the <> case.  I thought that the <> case had no meaning, so excluded it. But <> is apart of the total possibilities, so it should be included.

    Thank you for your explanation.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.