Ad
  • Default User Avatar

    As tip for R. Try to use new.env(hash = TRUE)

  • Default User Avatar

    Is variants like 1^2 -0^2 valid? For n=4 the count of the variants is equal to 3. It will be impossible without them

  • Default User Avatar

    I cannot turn into a fraction 0.2896412. My prog gave x[1]: "1/4,1/26,1/848,1/2381184,1/21600000000000000" but test
    y[1]: "1/4,1/26,1/848,1/2381184"

  • Default User Avatar

    It would be better if the argument for R passes as two numbers or a string. As argument passes to the function as float it should transfer to a fraction.
    For some floats it is not a problem. For example 0.75 = 75/100 = 3/4 But 22/23=0.9565217... is impossible to recover to a fraction by floating inferno. Using
    float in the formula leads to floating error

  • Default User Avatar

    As the result does not obey any rounding rules, so I cannot code it. There are some rules: to nearest integer, to even. At last I can throw out extra digits.
    But no one works. Ok. it needed to substract the final balance from the start balance and divide on count of items

  • Default User Avatar

    The version of R is very old here. In 4.0 rounding was corrected. I do not see how I can solve it. Rounding for .xx5 is not predictable. 26.575 rounds to 26.57 but 23.175 to 23.18. Mean gives the same result as the simple division sum on count of the elements.

  • Default User Avatar

    Please, check random tests for R. Some test are wrong. After five attempts I could submit my solving of this problem.
    I checked the top decision in RStudio. And for wrong test I got the value that was equal to the value from my script

  • Default User Avatar

    I am sorry. Yes, it was R.
    For example. For "CB02546520010" I got a mistake

    Test Failed
    act not equal to n.
    1/1 mismatches
    [1] 6188056489 - 5190136489 == 997920000

    koeff Factorial mult=koeff*factorial
    0 0 1,00 0,00
    1 1 1,00 1,00
    2 0 2,00 0,00
    3 0 6,00 0,00
    4 2 24,00 48,00
    5 5 120,00 600,00
    6 6 720,00 4320,00
    7 4 5040,00 20160,00
    8 5 40320,00 201600,00
    9 2 362880,00 725760,00
    10 0 3628800,00 0,00
    11 11 39916800,00 439084800,00
    12 12 479001600,00 5748019200,00

    Sum of the last column is 6188056489
    I do not see any mistakes.
    Sorry. Table appears only during the edit

  • Default User Avatar

    I'm sorry, but some tests do not pass by. I checked them in Excel and results were equals to mine. According to the internet references
    '1C731550201110' may be presented as 0x0! + 1x1!+ 1x2!+1x3!+0x4!+2x5!+0x6! +5x7!+5x8! + 1x9! + 3x10!+7x11!+12x12!+1x13!
    Sum of this equation is equal to 12265933929. But test gave me 11307930729. What's wrong?