Restructuring
This commit is contained in:
CT.rbcomposer.jsoncomposer.lockct.bat
data/primes
nbproject
phpunit.xmlsettings.ymlsolutions
CodeChef
CodeGolf
Generic
ProjectEuler
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
041
042
043
044
045
048
104
desc.ymlsrc
template.rttests
vendor
20
solutions/ProjectEuler/005/desc.yml
Normal file
20
solutions/ProjectEuler/005/desc.yml
Normal file
@ -0,0 +1,20 @@
|
||||
title: What is the smallest number divisible by each of the numbers 1 to 20?
|
||||
url: http://projecteuler.net/problem=5
|
||||
|
||||
desc: |
|
||||
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
|
||||
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
|
||||
|
||||
solution: |
|
||||
See code
|
||||
|
||||
solutions:
|
||||
solve.php:
|
||||
desc: Basic solution
|
||||
language: php
|
||||
solve.rb:
|
||||
desc: Basic solution in Ruby
|
||||
language: ruby
|
||||
solve.js:
|
||||
desc: Basic solution for NodeJS
|
||||
language: js
|
11
solutions/ProjectEuler/005/solve.js
Normal file
11
solutions/ProjectEuler/005/solve.js
Normal file
@ -0,0 +1,11 @@
|
||||
for(i=20;true;i+=20) {
|
||||
div = 19;
|
||||
|
||||
while(!(i % div)) {
|
||||
div--;
|
||||
if(div == 0) {
|
||||
console.log( i );
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
12
solutions/ProjectEuler/005/solve.lua
Normal file
12
solutions/ProjectEuler/005/solve.lua
Normal file
@ -0,0 +1,12 @@
|
||||
i=0
|
||||
while(true) do
|
||||
i = i + 20
|
||||
div = 19
|
||||
while((i % div) == 0) do
|
||||
div = div - 1
|
||||
if(div == 0) then
|
||||
print(i)
|
||||
os.exit()
|
||||
end
|
||||
end
|
||||
end
|
12
solutions/ProjectEuler/005/solve.php
Normal file
12
solutions/ProjectEuler/005/solve.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
for($i=20;true;$i+=20) {
|
||||
$div = 19;
|
||||
|
||||
while(!($i % $div)) {
|
||||
$div--;
|
||||
if($div == 0) {
|
||||
echo $i;
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
13
solutions/ProjectEuler/005/solve.rb
Normal file
13
solutions/ProjectEuler/005/solve.rb
Normal file
@ -0,0 +1,13 @@
|
||||
i = 0
|
||||
while (true)
|
||||
i = i + 20
|
||||
div = 19
|
||||
|
||||
while((i % div) == 0)
|
||||
div = div - 1
|
||||
if(div == 0) then
|
||||
puts i
|
||||
exit
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user