Big problems with BigIntegers

Back to General discussions forum

LordKuro     2024-01-03 13:22:38

Hi friends,

I'm currently using C# to solve these wonderful problems. However, I noticed that the BigInteger type available with the System.Numerics namespace is not supported on CodeAbbey. My previous solution was obtained using my own computer with a version of the C# compiler that supports BigInteger. I'm curious, however: is it actually part of the challenge to solve the problem without using types that deal with very large integers?

Thank you for reading,

LordKuro

CSFPython     2024-01-03 16:11:21

You didn't actually specify a problem. However, I cannot think of a Code Abbey problem where you would need to use a Big Integer library. Of the problems that I have contributed I have always ensured that the maximum size needed for integers is 2^63. That should be readily available to you. It is possible that you might find the use of Big Integers to be an advantage for a specific problem. Again I cannot think of one where that is the case. I think that you should consider how to solve your problem without Big Integers.

LordKuro     2024-01-04 07:16:17

Problem 67 (Fibonacci Sequence) specifically warns solvers that some input values can be a hundred digits long, which is obviously well ouside the range that most static typing languages admit for integral values of fixed size. This wouldn't be a problem for languages like python. Are you aware of any language agnostic approaches to dealing with the problem of large numbers?

qwerty     2024-01-04 09:40:37

After having solved task 14 (modular calculator), you can solve 67-th using knowledge you have learned from 14-th.

gardengnome     2024-01-04 10:32:00
User avatar

But there is also nothing wrong with using BigIntegers for this problem if you want - I did using Java.

Please note that you don't have to use the C# option offered on CodeAbbey; it's perfectly fine to solve a task locally on your machine and then copy the result and source code over and submit it. For fun, I used a quantum annealing program for one of the problems - Rodion is still working on making this capability available on CodeAbbey ;).

LordKuro     2024-01-05 20:21:22

@qwerty - I haven't yet solved Task 14 - thanks for the heads up!

@gardengnome - So cool! Did you have the opportunity to do the one-week D-Wave quantum programming training course? I remember trying to trick my PhD supervisor into letting me use my funding for it, but he was too smart for me. :P

gardengnome     2024-01-06 17:52:20
User avatar

Hi, no I have not done any formal D-Wave training, but they have a lot of good examples and demos, plus you can sign-up for an account with free time (though that comes with some strings attached). D-Wave's hybrid solver comes with a great python interface which abstracts from the underlying principles quite a bit, and that makes using their platform relatively straightforward.

Please login and solve 5 problems to be able to post at forum