Maths/Stats challenge - 1 of 2 - polls
|
05-26-2022, 12:01 PM
Post: #19
|
|||
|
|||
RE: Maths/Stats challenge - 1 of 2 - polls
Perhaps it is safer to avoid solutions that depends on how half-way cases is handled.
Starting from roundtrip condition: round(round(P[i]*n/100)*100/n) == P[i] // assumed integer P[i], unit = % → abs(round(P[i]*n/100)*100/n - P[i]) < 0.5 // half-way solutions removed → abs(round(P[i]*n/100)*100 - P[i]*n)*2 < n // multiply by 2n → abs(smod(P[i]*n, 100))*2 < n // smod = Euclidean symmetric remainder If n=100, LHS=0 → always roundtrip. If n>100, max(LHS)=100 < n → always roundtrip. We flip roundtrip condition for badn: Code: function badn(n,P) -- removed half-way solutions (05-25-2022 10:39 AM)Joe Horn Wrote: My 50g program finds these smaller denominator solutions: lua> firstn {23, 41, 36} 22 lua> firstn {12, 18, 45, 25} 51 lua> firstn {16, 2, 51, 31} 45 lua> firstn {45, 17, 25, 13, 0} 53 This matched Joe Horns answer, implied solutions does not have any half-way cases. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)