Skip to content

commit #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions isPrime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var isPrime = function(num){
var isPrime = true;
for (var i = 2; i<= Math.sqrt(num); i++){
if (num % i == 0) {
var isPrime = false
}
}
return isPrime;
}
console.log(isPrime(7));
Empty file added letterCount.js
Empty file.
28 changes: 28 additions & 0 deletions numSquare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//Create a function called numSquare that will return an array of all perfect square numbers up to, but not exceeding a max number.
/** sillySum(arr)
var arr = [0,1,2];

var sillySum = function (arr){
var count = 0;
for (i=0, i<arr.length, i += 1){
count += (i * arr[i]);
}
return count;
}
console.log(sillySum(arr));**/

var maxNumber = 20
var myArray = []

var numSquare = function (max){
for (i=0; i<maxNumber; i++){
if (i*i < maxNumber) {
var x = i*i;
myArray.push(x);
}

}
return numSquare
}
console.log (numSquare(maxNumber))

24 changes: 24 additions & 0 deletions primesMax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//Using your isPrime() function, create a function primes that will return an array of all prime numbers up to a certain amount.
var isPrime = function(num){
var isPrime = true;
for (var i = 2; i<= Math.sqrt(num); i++){
if (num % i == 0) {
var isPrime = false
}
}
return isPrime;
}


var Prime = function(maxPrime){
var primeArr = []
for (var i = 0; i<maxPrime; i++){
if (isPrime(i) == true ) { // calling/ passing a interger on a function
primeArray.push(i);

}
}
return primeArray;
}
console.log(prime(100));

11 changes: 11 additions & 0 deletions sillySum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sillySum(arr)
var arr = [0,1,2];

var sillySum = function (arr){
var count = 0;
for (i=0, i<arr.length, i += 1){
count += (i * arr[i]);
}
return count;
}
console.log(sillySum(arr));