The exact solution for 38.59 in base 15 is the repeating decimal 28.8cb3b3b3b3b3b3b3..., which means the given solution 28.8cb3b3b3b3b42d4a contains some "junk digits" at the end; it's not really fair to ask for those junk digits as opposed to any others. Also, it looks like trailing zeros are supposed to be removed, but some of the base 2 solutions contain a trailing zero.
You are correct. Thanks for the comment. Fixed the errors you detected as well as a few others. Should be good now.
Hi David, nice problem but there are still I believe a few precision issues remaining in the testsuite. For example the number "7285.4" as a float can only be precisely encoded up to ~1e-12 (since eps(7285.4)=9.0949e-13), so its base-15 representation cannot be defined with 16-decimal places (as that would require >1e-19 precision). I believe perhaps you could fix that simply entering the input decimal numbers using chars, which would avoid any limited-precision issues? (or by relaxing the requirements to fewer decimal places)
Changed and fixed the problem. Input is now cell array of character arrays.
It seems the precision issues were indeed fixed. :)
Not sure what the problem was, but I changed #6 and added some additional test problems.
Oh, the problem was with my algorithm, sorry. I am indeed using python's long int (for multiplication of large integers), but I was relying on str2num for some operations (which apparently introduced floats back in my code). After removing it, it worked out fine.
PS: This new update knocked out some wrong solutions (including some of mine). Awesome. :)
In each of test3, test4 and test5, there is a number with a decimal fractional part 0.0962. It appears as thought it was converted in each case as though the fractional part was 0.962.
Project Euler: Problem 6, Natural numbers, squares and sums.
Energy of a photon
Make an awesome ramp for a tiny motorcycle stuntman
Stuff the Board
Make a Star Pyramid
Number of Primitive Roots and Cyclic
Find R*Rp-N*Np=1 given gcd(R,N)=1
Optimal Asymmetric Encryption Padding decoding of message for RSA Cryptography
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office