Questions tagged [factoring]

"factoring" refers to the mathematical decomposition of integers into their factors

Factoring is operation of decomposing an object (typically an integer) into a product of other objects (typically its prime factors). It is also called "factorization"

59 questions
22
votes
2 answers

Chudnovsky binary splitting and factoring

In this article, a fast recursive formulation of the Chudnovsky pi formula using binary splitting is given. In python: C = 640320 C3_OVER_24 = C**3 // 24 def bs(a, b): if b - a == 1: if a == 0: Pab = Qab = 1 else: …
qwr
  • 9,525
  • 5
  • 58
  • 102
12
votes
4 answers

Is there an algorithm to find the nearest number with only small factors?

I need to do some real time DFT and the algorithm I am using is the most efficient when the number of samples can be broken down into small factors. Suppose that I have a number n and factors 2, 3, 5. How to find the nearest number (compared to n)…
Henricus V.
  • 898
  • 1
  • 8
  • 29
5
votes
7 answers

Factor an integer to something as close to a square as possible

I have a function that reads a file byte by byte and converts it to a floating point array. It also returns the number of elements in said array. Now I want to reshape the array into a 2D array with the shape being as close to a square as…
meetaig
  • 913
  • 10
  • 26
4
votes
1 answer

Bad rust code optimization or I just haven't done enough? (Euler #757)

I'm trying to solve my first ever project Euler problem just to have fun with Rust, and got stuck on what seems to be an extremely long compute time to solve Problem: https://projecteuler.net/problem=757 I came up with this code to try to solve it,…
Dragoon
  • 723
  • 6
  • 13
4
votes
2 answers

Haskell slower than Python in naïve integer factorization?

I'm taking a math course where we had to do some integer factorizations as an intermediate step to a problem. I decided to write a Python program to do this for me (we weren't being tested on our ability to factor, so this is completely above…
jdw1996
  • 65
  • 1
  • 4
3
votes
2 answers

How should I compute the null space of a rectangular sparse matrix over GF(2) in C/C++?

UPDATE: I ended up not using Eigen and implementing my own GF(2) matrix representation where each row is an array of integers, and each bit of the integer represents a single entry. I then use a modified Gaussian Elimination with bit operations to…
3
votes
1 answer

Tukey HSD for categorical and continuous variables in R

I want to do a post-hoc test for a significant ANOVA I've done successfully. I have 5 conditions (target_onset) across which I want to compare reaction times (key_resp.rt) in a df called data_clean. target_onset and key_resp.rt are columns. This is…
anntree
  • 261
  • 3
  • 10
3
votes
1 answer

Get X amount of integers that can all be multiplied together to get close to Y

It's hard to explain in just the title, but basically I have created a system that inputs some number N and outputs two numbers (excluding 1 and N) that can be multiplied together to be as close to N as possible (going over instead of under). Here's…
tryashtar
  • 278
  • 3
  • 13
3
votes
3 answers

Can someone explain to me this part of Dixon's factorization algorithm?

I've been trying to implement Dixon's factorization method in python, and I'm a bit confused. I know that you need to give some bound B and some number N and search for numbers between sqrtN and N whose squares are B-smooth, meaning all their…
polarbits
  • 187
  • 1
  • 3
  • 10
2
votes
4 answers

Find what 2 numbers add to something and multiply to something

Hey so I'm making a factoring program and I'm wondering if anyone can give me any ideas on an efficient way to find what two numbers multiple to a specified number, and also add to a specified number. for example I may have (a)(b) = 6 a + b = 5 So…
Belgin Fish
  • 19,187
  • 41
  • 102
  • 131
2
votes
0 answers

How to find the ith number that has n factors, considering that n isn't prime?

The brute force approach would be checking every possible number. If it has n factors: x++. until: x = i. but I just learned that you could get i = 1 that has n factors by: Getting the set S of prime factors e of n. Arrange set S in descending…
2
votes
1 answer

Automatic integer factoring for 310-digit decimal numbers

Is here some software, which is capable of factoring a 310-digit decimal integer number into primes? There was msieve, which I successfully used for 120-digit factoring, but 310 digit is greater than max allowed number of 308-digit for msieve. PS:…
osgx
  • 90,338
  • 53
  • 357
  • 513
2
votes
2 answers

Fastest way to Factor (Prime-1)/2 for 64-bit Prime?

I'm trying to gather some statistics on prime numbers, among which is the distribution of factors for the number (prime-1)/2. I know there are general formulas for the size of factors of uniformly selected numbers, but I haven't seen anything about…
Extrarius
  • 154
  • 1
  • 8
2
votes
2 answers

Comparing Sympy factor results false

I've found an issue about Sympy that I can't understand. Why does this return false... factor(81*q + 90) == 9*(9*q + 10) ... whilst this returns true? factor(q**2-64) == (q+8)*(q-8) When I type factor(81*q + 90) the output is exactly this…
user2905179
  • 21
  • 1
  • 6
2
votes
2 answers

Mathematically navigating a large 2D Numeric grid in C#

I am trying to find certain coordinates of interest within a very large virtual grid. This grid does not actually exist in memory since the dimensions are huge. For the sake of this question, let's assume those dimensions to be (Width x Height) =…
Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
1
2 3 4