D
D
DmItrENub2022-02-13 23:50:01
C++ / C#
DmItrENub, 2022-02-13 23:50:01

What is the logic behind the DWORD variable?

I need a variable of 1024 bytes (I want to learn a lot of prime numbers myself), and the logic of the variable will be like that of a DWORD. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2022-02-14
@wataru

Can. This is called long arithmetic (the link has an implementation example). You will have to store the digits of the number in an array yourself and perform addition / multiplication / subtraction in a column, in cycles. You can store decimal digits (fast output, slower counting) or binary, for example, 32 bits per array cell (faster work, you will have to convert to decimal when outputting).
To find prime numbers, it is better to use some kind of primality test, for example, the Miller-Rabin test

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question