Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
0 replies
37 views

I'm interested in implementing a BigInteger class with functionality (took cook multiplication, etc), I already did so for a class project, in Java. I think it would be really cool to do so in a ...
user32603240's user avatar
Advice
0 votes
1 replies
27 views

A probablistic method to find a factor is Pollard's rho, which either returns a factor (not necessarily prime), or failure (mayb prime, or not). The GNU MP (6.3.0.) function mpz_probab_prime_p just ...
Rainer Glaschick's user avatar
3 votes
1 answer
153 views

I'm currently trying to implement Karatsuba Sqrt for my BigInteger module in luau, though I'm having trouble with its accuracy and I don't know what I'm doing wrong. Karatsuba function: local function ...
fosterchild's user avatar
Best practices
3 votes
6 replies
154 views

I am working on a multiplication routine in a big integer library in POSIX C99 with a signature of bigint_st *bigint_mul(bigint_st *dest, const bigint_st *a, const bigint_st *b). Many of the routines ...
Eric Pruitt's user avatar
  • 1,903
1 vote
2 answers
142 views

Is it possible to parse a JSON string like '{id: 3458764513820541000}' using zod without resorting to an additional library like json-bigint?
Emre's user avatar
  • 6,269
2 votes
0 answers
247 views

I am developing an algorithm that multiplies large numbers. I am doing LeftLength x RightLength multiplications. Karatsuba algorithm does less multiplications. Currently, the algorithm is more ...
Fatih Doganay's user avatar
0 votes
0 answers
98 views

Private Sub routine() Dim bytes() As Byte Dim n As BigInteger = 1 Dim s As Integer = 1 If System.IO.File.Exists("resources.bin") Then Dim fs2 = New IO.FileStream(&...
George Robinson's user avatar
1 vote
0 answers
84 views

...such as infix operator fun BigInteger.plus(other: Int) = this + other.toBigInteger() infix operator fun Int.plus(other: BigInteger) = toBigInteger() + other infix operator fun BigInteger....
Boris's user avatar
  • 39
0 votes
0 answers
165 views

I want to implement Knuth's Algorithm D for division on C (Link to Knuth's book, p272). In step "D4. [Multiply and subtract.]", it states: if the result of this step is actually negative, (...
Daan's user avatar
  • 39
0 votes
1 answer
106 views

I can reproduce this 1 line all the time & I'm thrown off why .Net 8 x64 is converting to a negative decimal. BigIntegers have to be used because of the hex sizes. Conversion URL fact checking ....
JRrelyea's user avatar
  • 298
0 votes
0 answers
136 views

I am working with extremely large numbers and would like to verify my Karatsuba multiplication result ((2^136279841)-1)^2 which needs (532 344 * _m256i_epi64)^2 i.e. 4,258,752 uint64_t to store the ...
Caster's user avatar
  • 51
2 votes
1 answer
139 views

Knuth Algorithm D, during the normalization step (D1), states to set d to (b-1)//v_hi where b is the basis (word size or half-word size) and v_hi is the upper limb of the denominator. Then multiply ...
Duncan Townsend's user avatar
1 vote
1 answer
87 views

I have written this block of code, in an attempt to create a generic random array generator (quite an interesting approach, if I must say so myself) public unsafe class RandomArray<T> : ...
Lambda dot Joburg's user avatar
1 vote
1 answer
237 views

I think I have right algorithm, but when the values increase to 106 and more, I exceed the MEMORY or TIMELIMIT allowed. At first I tried to push the elements to a vector, then I changed the method to ...
lilof's user avatar
  • 15
5 votes
1 answer
190 views

I'm confused about the time complexity of this algorithm: function fib(n) if n = 0 return 0 else var previousFib := 0, currentFib := 1 repeat n − 1 times // loop is ...
Angela Liss's user avatar
1 vote
1 answer
456 views

I wrote my own BigIntegerConverter for JSON serialization/deserialization (.Net System.Text.Json) In the Read method I checked if ValueSequence is used ... string stringValue; if (reader....
Iaman Swtrse's user avatar
1 vote
0 answers
188 views

JavaScript's number can represent 18446744073709552000: > n = '18446744073709552000' > Number(n) 18446744073709552000 > String(Number(n)) === n true So I would expect BigInt(...
everett1992's user avatar
  • 2,710
-2 votes
1 answer
116 views

I've converted a file into bytes and have a vec/array of [68, 114, 97, 109, 97, 116, 105, 99, 32, 115, 97, 120, 97, 112, 104, 111, 110, 101, 32, 112, 108, 97, 121, 115, 32, 73, 78, 32, 84, 72, 69, 32, ...
Thetrue kingofwaffles's user avatar
-1 votes
1 answer
63 views

The following equation is same as doing nothing to the integer ((as.bigz(27080235094679553)+1028)*2)/2 - 1028 However, the answer to this in console is 27080235094679552. To get the correct answer I ...
Chirag Patil's user avatar
1 vote
2 answers
77 views

I want to rewrite this function code to BigInteger class in Java: static int power(int x, int y, int p) { int res = 1; // Initialize result while (y > 0) { // ...
parsa.ni's user avatar
0 votes
0 answers
49 views

I'm returning a dictionary object to a web route. And annoyingly, my frontend JS is automatically rounding all the integer values in the response.json() let currentUserId; let path = "/account?...
RHO's user avatar
  • 51
0 votes
1 answer
137 views

I was working with a zk project. Using some renowned libraries in the field. I wanted to print the input variable with single value in decimal representation but it's printed as Inputs: BigInt([...
Purushotam Sangroula's user avatar
2 votes
1 answer
283 views

I am trying to generate 1024bits random numbers with this code: var bytes = RandomNumberGenerator.GetBytes(128); var number = new BigInteger(bytes); But when I inspect my number using BigInteger ...
Adrian's user avatar
  • 41
0 votes
1 answer
581 views

I want to calculate: let n1 = BigInt(256); let n2 = BigInt(1024); let n3 = BigInt(3); let n4 = BigInt(40); let res = n1.pow(n2.pow(n3) * n4); let len = res.to_string().len(); I tried num crate, but ...
Lomírus's user avatar
0 votes
0 answers
49 views

I have a field "old" with the data type BigInteger in Spring Boot. Property in Entity: @Column(name = "old") private java.math.BigInteger old; In the database, this field "...
PureFlow's user avatar
0 votes
1 answer
205 views

Given a BigInteger in Kotlin that is in the range between 0 and 2^64, how can I convert this BigInteger to a ULong? Kotlin provides toULong() extension methods only for Byte/Short/Int/Long/Float/...
Danilo Bargen's user avatar
0 votes
1 answer
63 views

Let's say I want to write the factorial function in Julia in the following recursive way: FACTORIAL(n) = n==1 ? 1 : n*BigInt(FACTORIAL(n-1)) Doing so, it shows the following error when trying to ...
CLAUDE's user avatar
  • 323
3 votes
1 answer
139 views

I wrote an implementation of quicksort in C as an Elixir NIF. I'm aware that there is a BIF for that, I'm just doing this to teach myself NIFs. Now my code works so far, that is, I can call ...
mx-ws's user avatar
  • 31
0 votes
1 answer
3k views

I assumed this would be a simple issue with abundant answers on the Internet. But that does not appear to be the case. I need to convert a Go big.Int into a regular integer (e.g., int, int32, or ...
Cade Bryant's user avatar
  • 1,135
1 vote
1 answer
174 views

In C++, I want to get the square root of a big int. The number is less than the maximum integer represented as a double, so this approach should work. The ttmath library doesn't have a square root ...
rkg125's user avatar
  • 91
0 votes
0 answers
51 views

In my current side project my code is performing a large amount of very simple computation on large numbers. I'm using the library "[email protected]" to handle the large number aspect. I'...
Yug Damon's user avatar
  • 511
0 votes
0 answers
122 views

Most of the sites I've been reading state that a zero-sized array, single element array or Flexible Array Members is the way to go when a dynamic array is needed, but the definition of an integer in ...
deltakid0's user avatar
-1 votes
1 answer
64 views

How would I convert Int 623527832412487691 to Int 623527832412487691n without the number changing value I don't want Int 623527832412487691 to turn to Int 623527832412487700 as apparently JavaScript ...
Alfie's user avatar
  • 11
0 votes
0 answers
184 views

This comes up when evaluating a rolling hash of a string by subtracting the old weight of a character and adding a new weight for a new character. Python has infinite length digits and is able to ...
Dracula's user avatar
  • 3,120
0 votes
1 answer
79 views

import java.util.Scanner; import java.math.BigInteger; public class LargeSum { public static void main(String[] args) { Scanner inp=new Scanner(System.in); int limit=inp.nextInt()...
Kornusiap's user avatar
0 votes
1 answer
115 views

I have the below console application to check the time taken for doing a specific operation with BigInteger in C#. using System.Diagnostics; using System.Numerics; Stopwatch timer = new Stopwatch(); ...
Azeeb's user avatar
  • 91
0 votes
3 answers
164 views

I need to find the minimum and maximum values that can be calculated by summing exactly (size - 1) elements in the arrays Example: arr = [1,2,3,4,5] minSum = 1+2+3+4 = 10 , maxSum = 2+3+4+5 = 14 ...
Jahnavi Achanta's user avatar
1 vote
2 answers
176 views

How do I add two big integers, I have tried using arrays and it still has some bugs. Ex: A 23 digit + 25 digit positive integer (2345235... + 34634235....) I've tried using arrays to separate the ...
Richard Bryan's user avatar
0 votes
1 answer
918 views

Could someone help me to create a HOOK in FASTIFY to automatically serialize these types of values ​​in all app.ts endpoints I managed to solve the problem using .toString, but I wanted a way to do ...
Brayan Vinicius Jordan's user avatar
0 votes
1 answer
1k views

By using this website I can calculate for example x = 0.28 y = 1e18 x * y = 280,000,000,000,000,000 How can I do this in javascript while x could be any number, including ints, and y could be any ...
user2640145's user avatar
0 votes
0 answers
3k views

I am trying to solve a simple RSA CTF challenge, but I am facing problems that go beyond the theory behind the attack (or at least I guess so). Basically, I have an oracle at disposal that will first ...
Shark44's user avatar
  • 823
1 vote
1 answer
187 views

I'm trying to write a generic function that operates on integers, which can accept either primitive integers or multiprecision ones (via rug). The tricky bit is that references to rug Integers have ...
KSV's user avatar
  • 41
1 vote
0 answers
126 views

I'm new to C# and I'm trying to write code for the Fibonacci sequence. I get an error when I use the BigInteger type in my code. I would be grateful if you could help me solve this problem. this is my ...
Ali jafari's user avatar
0 votes
4 answers
146 views

I have never used long integer or BigInteger format numbers in my Java code, and this aspect of the IP2Location databases does not appear to be documented. I need to know which it is, so that I can ...
Mick's user avatar
  • 681
5 votes
1 answer
203 views

I'm looking for fast way to get n last digits of number, represented as BigInteger, lets say, m. Calculating m mod(10^n) (or converting to string) seems too expensive, because the sizes of n are ...
Vitaliy Volovyk's user avatar
1 vote
2 answers
219 views

I'm trying to work on addition of about 25 digit numbers in C. The result I am getting is a little different from the expected, possible cause datatype. /* Online C Compiler and Editor */ #include <...
Kester George's user avatar
0 votes
1 answer
1k views

I have a smart contract I am interacting with but I cannot seem to form a proper JSON object using these variables. I have been able to pull the data and log it, I've even been able to pull other data ...
Technically Web3's user avatar
0 votes
0 answers
145 views

I am doing this side project where I try to understand the internal implementation of some of the widely used utility classes in Java. I want to know how BigInteger store's the number internally. What ...
ng.newbie's user avatar
  • 3,372
0 votes
2 answers
111 views

look at the below Java Code : long a = (long) 10e9+7; long b = (a * a); System.out.println("b is " + b); System.out.println("b%a is " + (b%a)); ...
Pawan Patel's user avatar
0 votes
1 answer
132 views

I am doing a little side project where I am delving into the implementation of some popular classes that we use in the Java Libraries. The first on my list is BigInteger. I am interested in ...
ng.newbie's user avatar
  • 3,372

1
2 3 4 5
41