A simple "C" program

float sumarray[50][50];
int sumx=49;
int sumy=49;
float sumitall(){
int x,y;
y=0;
x=0;
sumarray[0][0]=1;
 for (x=0;x<=sumx;x++){
  sumarray[x][0]=1;
 }
 for (y=0;y<=sumy;y++){
  sumarray[0][y]=1;
 }
 for (x=1;x<=sumx;x++){
  for (y=1;y<=sumy;y++){
  sumarray[x][y]=sumarray[x-1][y]+sumarray[x][y-1];
  }
 }
return sumarray[38][48];
}
int main(int argc, char **argv) 
{  
int i,j;
float simplex;
simplex=sumitall();
i=37;
j=47;
simplex=sumarray[i][j];
printf ("array %d  %d   = = =  %f \n",i,j,simplex);
simplex=sumarray[j][i];
printf ("array %d  %d   = = =  %f \n",i,j,simplex);
    return 1;
}

--------------------16
------------1------------2-----(24 digits) 
123 456 789 012 345 678 901 234
931 063 954 784 222 957 273 088 float
931 063 954 784 222 957 273 088 creal()
931 064 028 937 850 290 438 144 double
931 064 028 937 850 181 779 456 long double
931 064 028 937 850 181 759 840 solution
931 064 -28 937 850 181 759 840 27 digit precision
/* Paul Mohr 27 digit precision answer to challenge */
#include <stdio.h>
#include <stdlib.h>
long long int sumarray[60][60];
int sumx=37;
int sumy=50;
long long int sumitall(){
long long int zeroed=0;
long long int abillion=1000000001;
int x,y;
 for (x=0;x<=sumy;x++){
  sumarray[x][0]=1;
  sumarray[x][1]=zeroed;
  sumarray[x][2]=zeroed;
  sumarray[x][3]=zeroed;
  sumarray[x][4]=zeroed;
  }
 for (y=1;y<=sumx;y++){

 for (x=1;x<=sumy;x++){
  sumarray[x][0]=sumarray[x][0]+sumarray[x-1][0];
    if (sumarray[x][0] >= abillion){
   sumarray[x][0] = sumarray[x][0]-abillion;
   sumarray[x][1] = sumarray[x][1]+1;
     if (sumarray[x][1] >= abillion){
    sumarray[x][1] = sumarray[x][1]-abillion;
    sumarray[x][2] = sumarray[x][2]+1;
    }
      if (sumarray[x][2] >= abillion){
     sumarray[x][2] = sumarray[x][2]-abillion;
     sumarray[x][3] = sumarray[x][3]+1;
     }
   }
  sumarray[x][1]=sumarray[x][1]+sumarray[x-1][1];
    if (sumarray[x][1] >= abillion){
   sumarray[x][1] = sumarray[x][1]-abillion;
   sumarray[x][2] = sumarray[x][2]+1;
     if (sumarray[x][2] >= abillion){
    sumarray[x][2] = sumarray[x][2]-abillion;
    sumarray[x][3] = sumarray[x][3]+1;
    }
   }
  sumarray[x][2]=sumarray[x][2]+sumarray[x-1][2];
    if (sumarray[x][2] >= abillion){
   sumarray[x][2] = sumarray[x][2]-abillion;
   sumarray[x][3] = sumarray[x][3]+1;
   }
 }
 }
return 0;
}
int main(int argc, char **argv) 
{  
int i;
long long int simplex;
simplex=sumitall();
 for (i=47;i<=47;i++){
 simplex=sumarray[i][2]+4;
 printf ("%Ld x e18 + ",simplex);
 simplex=sumarray[i][1]+17;
 printf ("%Ld x e9 + ",simplex);
 simplex=sumarray[i][0]+argc;
 printf ("%Ld \n",simplex);
 }
return 1;
}

0 comments:

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen