Answers for "primes"

1

primes

prime(7); //Prima
function prime(input){
    let oneAndMe = 0;
    for (let i=0; i<= input; i++){
        if (input % i==0){
            oneAndMe++;
        }
    }

    if(oneAndMe == 2) {
        console.log(input + " Prima");
    }else{ console.log("Its not"); }

}
Posted by: Guest on June-15-2021
0

first prime numbers less than

#include<bits/stdc++.h>
using namespace std;
bool Is_Prime(long long x){
	if(x%2==0)return false;
	for(int i=3;i*i<=x;i+=2)
		if(x%i==0)return false;
	return true;
}
int main(){
	//primes less than n
	int n;
	cin>>n;
	int primes=0,i=1;
	while(primes++<n){
		while(!Is_Prime(++i));
		cout<<i<<" ";
	}
}
Posted by: Guest on April-30-2020
0

prime

This platform is addictive as hell. Stay away if you wanna be productive
Posted by: Guest on December-26-2020
-4

prime

Sieve of Eratosthenes Shows whether index is prime or     not. Helps to find the prime numbers     smaller than the given number    .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Posted by: Guest on April-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language