Mathematical Riddles
Lesson 1 of 20 in Coddy's Mathematical Riddles course.
The course will provide students with ways of thinking and strategies for solving problems and puzzles in a variety of mathematical topics: combinatorics, number theory, algebra, mathematical games, and other diverse topics. In this course we will focus on problems in the complete lattice.
In Coddy, We solve using programming.
First lesson deals with multiplies of numbers, the greatest common divider (GCD) and the least common multiplier (LCM). Both GCD and LCM have specific lessons. Other lessons are on Fibonacci numbers, on primes, on Diophantine equations, on Pythagorean triplet, on binary numbers and on Palindromes.
Let's start with a challenge!
Challenge
Easy60 is the smallest number that can be divided by each of the numbers from 1 to 5 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to N?
Write a function minDivider which gets N integer and returns the smallest number that can be divided by each of the numbers from 1 to N without any remainder.
Try it yourself
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "solution.h"
int main() {
int n;
if (scanf("%d", &n) != 1) n = 0;
int r = minDivider(n);
printf("%d\n", r);
return 0;
}