Skip to content

Instantly share code, notes, and snippets.

@Cxarli
Last active August 29, 2015 14:20
Show Gist options
  • Save Cxarli/17934758fd2a84bb422b to your computer and use it in GitHub Desktop.
Save Cxarli/17934758fd2a84bb422b to your computer and use it in GitHub Desktop.
using System;
namespace Math
{
public class Math
{
int[] stack=new int[1024];
int pointer=2;
public Math ()
{
stack[0]=1;
stack[1]=1;
int toMake=2;
while(toMake<100) {
if(!canMake(toMake))
stack[pointer++]=toMake-1;
toMake++;
print();
}
Console.WriteLine("~~~");
Console.WriteLine("Length: "+pointer);
}
public void print() {
Console.WriteLine("~~~");
for(int i=0; i<pointer; i++) {
Console.Write(stack[i]+" ");
if(i%20==0 && i!=0)
Console.Write("\n");
}
Console.Write("\n");
}
public bool canMake(int toMake) {
for(int x=0; x<pointer; x++) {
for(int y=0; y<pointer; y++) {
if(x==y) continue;
if(stack[x]+stack[y]==toMake)
return true;
}
}
return false;
}
public static void Main(string[] args) {
new Math();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment