ProjectEuler Problem 2 in IAS Machine Code

If you want to learn more about the IAS computer, check this post. The problem: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … By considering […]

ProjectEuler Problem 1 in IAS Machine Code

The IAS Machine was the first electronic computer built at the Institute of Advanced Studies (hence the name) at Princeton. The leader of the project was John Von Neumann, who was also a consultant at the ENIAC project (the first general purpose electronic computer). The IAS project was quite important because it was one of […]

Solution to Problem 15 on ProjectEuler.net

The problem: ——- Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 2020 grid? ——- My Solution #include <stdio.h> int main(){   int i,j,x,y;   long long int mat[21][21];   i=0;   for (j=0;j<21;j++)     mat[i][j]=1;   j=0;   for (i=0;i<21;i++)     mat[i][j]=1;   for […]

CodeChef.com Easy Problem: Transform the Expression

He’s an interesting albeit relatively easy problem from CodeChef.com: ———- Reverse Polish Notation (RPN) is a mathematical notation where every operator follows all of its operands. For instance, to add three and four, one would write “3 4 +” rather than “3 + 4”. If there are multiple operations, the operator is given immediately after […]

CodeChef Easy Problem: Sums in a Triangle

Still practicing for Facebook Hacker Cup 2013. The problem below is a classic, although I wouldn’t necessarily classify it as “easy” as the guys from CodeChef did. Anyway here you go: ———- Let’s consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three […]