All Questions
15 questions
3
votes
1
answer
158
views
A simple JavaScript function that does prime factorization
This is a simple JavaScript function that does prime factorization.
I wrote it on an Android phone with online editor (I don't have access to computers in night time):
Code:
...
1
vote
3
answers
398
views
Find the 10001st prime number
Project Euler 7: What is the 10 001st prime number?
I currently have this code:
...
3
votes
3
answers
348
views
Project Euler 50: Consecutive prime sum
I just finished solving Project Euler's 50th problem, but it's awfully slow. I'd like to hear your thoughts on my code's efficiency and practices.
Problem Statement
The prime 41, can be written as the ...
2
votes
1
answer
255
views
Hackerrank problem -"Another Prime Problem"
I came across this issue in the problem titled: Another Prime Problem. Here's my solution with JavaScript which passed test case-1, but for other test cases it led to timeout.
...
2
votes
1
answer
926
views
Codewars: Prime Streaming (PG-13)
I'm timing out on Codewars' Prime Streaming kata. Below is my code:
...
0
votes
1
answer
137
views
A faster way to compute largest prime factor (Again, but a lot better)
I came up with this code after implementing the feedback given by @200_success. The previous one (A faster way to compute the largest prime factor) tested my patience, but still failed to give the ...
11
votes
5
answers
3k
views
A faster way to compute the largest prime factor
I am self-learning js and came across this problem(#3) from the Euler Project
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Logic:...
1
vote
1
answer
2k
views
code to check if number is prime number
I have written a code to check if the number is prime number are not.
I pass the number from command line argument, and check if the number is prime.
I have written a function for it which returns ...
1
vote
2
answers
473
views
Project Euler problem 3: Largest prime factor in JavaScript
I have created a soloution for Project Euler: Problem 3 - Largest Prime Factor in JavaScript:
...
4
votes
2
answers
3k
views
CodeWars: Gap in Primes
I wrote JavaScript code for finding the first two consecutive prime numbers (that doesn't have divisors except one and itself) with a specific gap between them. It works well but take too much time to ...
0
votes
1
answer
687
views
Largest prime factor of a given number
I'm solving Problem 3 in Project Euler:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143?
Most answers I found made use of array to ...
3
votes
2
answers
275
views
Very slow Project Euler Q3 (largest prime factor of a large number)
My code returns the correct answer for the example (highest prime of 13195 is 29), but when I test against the number in the question my code basically is too slow for my liking.
The prime factors ...
2
votes
2
answers
456
views
ProjectEuler Problem #3
I'm working on projecteuler.net problems, and I made this for problem #3:
...
5
votes
1
answer
737
views
Project Euler #41 - pandigital prime
I've written a solution to Euler 41:
We shall say that an n-digit number is pandigital if it makes use of
all the digits 1 to n exactly once. For example, 2143 is a 4-digit
pandigital and is ...
8
votes
2
answers
5k
views
Checking for circular primes - Project Euler Problem 35
I have been trying to solve Project Euler problem number 35. The problem is to find:
How many circular primes are there below one million?
A circular prime is a prime where all the rotations of its ...