Restructuring

This commit is contained in:
2024-07-01 13:49:44 +00:00
parent f11b705ef0
commit 8d60e1b905
194 changed files with 1296 additions and 112 deletions
CT.rbcomposer.jsoncomposer.lockct.bat
data/primes
nbproject
phpunit.xmlsettings.yml
solutions
CodeChef
easy
HS08TEST
TEST
CodeGolf
Generic
ProjectEuler
src
template.rt
tests
vendor

@ -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

@ -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);
}
}
}

@ -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

@ -0,0 +1,12 @@
<?php
for($i=20;true;$i+=20) {
$div = 19;
while(!($i % $div)) {
$div--;
if($div == 0) {
echo $i;
die;
}
}
}

@ -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