huge digits

hex 96 Reputation points
2021-06-16T12:40:54.977+00:00

How to make variable with this huge number with more than 620 digits in Csharp
p = 62565723754058110134184001269265026995419782768569177086204348747687732348848236769229781932708360465701357972344794565740615466515350423240090663020164879389985960193699399021364476070220725008450692501480668763322130258028788020093565050589724307750757980284019043386143246778466757018917406796414009849419506348774472169291285638213327375088919193217225759978659412101547650960434445699162046310136838178962085668568787752550883666134594662568820237321652729335696495208126896696594655696472740672048375181433229185450187517242248770941384487990146267643257056551996515645627561800669155515249895921530521876406192277

I want calculate this number with pow that why I need make variable with huge number to calculte it
if there is any way to do it reply here thx

Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. hex 96 Reputation points
    2021-06-16T13:16:29.45+00:00

    using System.Numerics;

    BigInteger number = BigInteger.Parse("23766...........08993");
    Console.WriteLine(Math.Pow(number,14));

    show me this Error :
    cannot convert from 'System.Numerics.BigInteger' to 'double'

    IDE gave me some hint i applayed
    Code :

    using System.Numerics;

    BigInteger number = BigInteger.Parse("23766...........08993");
    Console.WriteLine(Math.Pow((double)number,14));
    OutPut :

    106220-image.png


1 additional answer

Sort by: Most helpful
  1. Viorel 122.6K Reputation points
    2021-06-16T12:53:07.287+00:00

    Try the BigInteger type:

    using System.Numerics;
    . . .
    BigInteger p = BigInteger.Parse( "62565723754058110. . . . .6192277" );
    

    Check the documentation for available operations.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.