number-theory Questions
3
Solved
So I have an integer, e.g. 1234567890, and a given set of numbers, e.g. {4, 7, 18, 32, 57, 68}
The question is whether 1234567890 can be made up from the numbers given (you can use a number more t...
Missy asked 22/12, 2015 at 21:42
2
Solved
I already have prime factorization (for integers), but now I want to implement it for gaussian integers but how should I do it? thanks!
Consensual asked 16/2, 2010 at 0:4
2
Solved
Extremely fast method for modular exponentiation with modulus and exponent of several million digits
As a hobby project I'm taking a crack at finding really large prime numbers. The primality tests for this contain modular exponentiation calculations, i.e. a^e mod n. Let's call this the modpow ope...
Gibby asked 11/7, 2014 at 10:52
1
From the math principle:
A number N is expressible as a sum of 2 squares if and only if in the prime factorization of N, every prime of the form (4k+3) occurs an even number of times!
What I d...
Slowworm asked 28/8, 2015 at 11:47
2
The cycle leader iteration algorithm is an algorithm for shuffling an array by moving all even-numbered entries to the front and all odd-numbered entries to the back while preserving their relative...
Worsen asked 15/3, 2014 at 14:21
6
Solved
I would like to calculate:
abcd... mod m
Do you know any efficient way since this number is too big but a , b , c , ... and m fit in a simple 32-bit int.
Any Ideas?
Caveat: This question is ...
Messick asked 19/11, 2010 at 8:40
2
Solved
Note: Updated on 06/17/2015. Of course this is possible. See the solution below.
Even if anyone copies and pastes this code, you still have a lot of cleanup to do. Also note that you will have pro...
Respect asked 12/6, 2015 at 4:36
3
Given a number X , what would be the most efficient way to calculate the product of the prime factors of that number?
Is there a way to do this without actual factorisation ?
Note-The product of pr...
Stonybroke asked 10/5, 2015 at 16:57
3
Solved
Here is the problem (Summation of Four Primes) states that :
The input contains one integer number N (N<=10000000) in every line. This is the number you will have to express as a summation of...
Deodorant asked 31/1, 2011 at 7:29
3
Solved
The problem is to find the largest set S of positive integers such that the sum of the squares of the elements of S is equal to a given number n.
For example:
4 = 2²
20 = 4² + 2²
38 = 5² + 3²...
Holliholliday asked 6/10, 2014 at 18:43
2
Solved
I was watching a video on computer architecture and a question came to my mind. How does addition and basic operations work on computers? I mean, i know that 2+2 = 4 but i don't know why? i just kn...
Evert asked 27/9, 2014 at 5:41
1
Problem: http://www.spoj.com/problems/DIVREL
In question, we just need to find the maximum number of elements which are not multiples (a divisible by b form) from a set of elements given. If we ju...
Berlinda asked 25/5, 2014 at 18:23
5
I want to know whether the task explained below is even theoretically possible, and if so how I could do it.
You are given a space of N elements (i.e. all numbers between 0 and N-1.) Let's look a...
Lentic asked 6/5, 2014 at 18:25
2
Solved
The code below works perfectly but I would like someone to explain to me the mathematics behind it. Basically, how does it work?
#include <stdio.h>
#include <stdlib.h> /* atoi */
#de...
Milliard asked 21/4, 2014 at 17:33
2
Solved
So I'm trying to do some number theory work, and I was using Mathematica but thought that Haskell would be more suited to dealing with infinite lists (as AFAIK Mathematica doesn't have lazy evaluat...
Ganister asked 14/1, 2014 at 20:40
3
Solved
While answering another, I stumbled over the question how I actually could find all factors of an integer number without the Symbolic Math Toolbox.
For example:
factor(60)
returns:
2 2 3 5
...
Ernieernst asked 9/1, 2014 at 18:49
4
Solved
-----Modification of code requested --------
Question : Count the Fast Triangular Series Number which is having 50 Factors ?
Elaborated : Let's say there is a series
1 : 1
3 : 1+2
6 : 1+2+3
...
Lamination asked 9/7, 2013 at 6:24
1
Solved
Frobenius numbers of a set exist iff the gcd of the numbers of the set is 1. Given a set of positive integers with at most 10 elements such that the gcd of all the elements is 1, how can we compute...
Landscapist asked 4/12, 2013 at 5:50
1
Solved
I am currently working on Project Euler and thought that it might be more interesting (and a better learning experience) if don't just brute force all of the questions. On question 3 it asks for pr...
Feast asked 13/6, 2013 at 6:35
1
Solved
I want to know how to obtain the remainder by dividing an integer with another integer (both positive) using bitshift or bitwise operators only. The / operator or % operator should not be used.
Fo...
Rosado asked 25/11, 2012 at 4:8
1
Solved
For instance, the number 24 has prime factorization 2^3*3^1, and can be written in the following ways
1*24
2*12
2*2*6
2*3*4
2*2*2*3
3*8
4*6
I may have missed one but you get the idea.
I tried l...
Firebrat asked 15/11, 2012 at 1:58
3
Solved
Here is an interesting programming puzzle I came across . Given an array of positive integers, and a number K. We need to find pairs(a,b) from the array such that a % b = K.
I have a naive O(n^2) ...
Pageantry asked 4/10, 2012 at 17:54
1
Solved
Generating Prime numbers is a toy problem that I often attempt from time to time, especially when experimenting with a new programming language, platform or style.
I was thinking of attempting to ...
Frear asked 24/9, 2012 at 6:18
1
Solved
I'm looking for the number of integer partitions for a total N, with a number of parts S, having a maximum part that is exactly X, without enumerating all of them.
For example: all partitions of 1...
Gaslight asked 15/9, 2012 at 3:37
3
Yesterday, I appeared in an interview. I was stuck in one of the question, and I am asking here the same.
There is an array given that shows points on x-axis, there are N points. and M coins also ...
Conger asked 8/9, 2012 at 7:12
© 2022 - 2024 — McMap. All rights reserved.