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"

52 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
  • 6,786
  • 3
  • 42
  • 72
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.
  • 858
  • 1
  • 7
  • 22
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
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
  • 258
  • 3
  • 12
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
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…
2
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
  • 141
  • 1
  • 6
2
votes
5 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
  • 778
  • 7
  • 23
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
  • 13,199
  • 12
  • 71
  • 154
1
vote
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
  • 16,577
  • 39
  • 98
  • 128
1
vote
1 answer

R - ordered factor over multiple columns

I'm pretty brand new to R, so please excuse any R grammer errors here... I have a 19 question likert survey saved in a data frame (19 columns). The responses are numeric and converted to characters. I would like to change the Likert scores to factor…
KLenny
  • 21
  • 1
1
vote
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
  • 80,853
  • 42
  • 303
  • 470
1
vote
1 answer

Factoring categorical variable vectors in a single column of a data frame?

I'm working on importing a data set which has a column with categories "PR","CG","SH","CF","SC","PI","PA". However, some rows have multiple values (e.g. PR,CG). I was able to split those strings into lists using FFG=str_split(FFG,pattern=","), but…
mon
  • 17
  • 3
1
vote
3 answers

non-prime factorings with some repeats

Let's say we have numbers factors, for example 1260: >>> factors(1260) [2, 2, 3, 3, 5, 7] Which would be best way to do in Python combinations with every subproduct possible from these numbers, ie all factorings, not only prime factoring, with sum…
Tony Veijalainen
  • 4,921
  • 20
  • 30
1
2 3 4