#include /*** New outputformat & 2 start parameter supported: 2002-11-07 (C) GPL ***/ /*** Author: Achim Flammenkamp, University of Bielefeld, achim@uni-bielefeld.de Reference: Collected Papers of Srinivasa Ramanujan (1927), chapter 15: Highly Composite Numbers p. 78-128, paragraph 2-31 p. 81-111 ******************************************************************************/ #ifndef N #define N (1<<8) #endif double lnp[N]; init_prime_logs() { unsigned h, i, j, k; extern double log(double); lnp[h=0]= 2; for (k=1,i=3;k= h) lnp[k++] = i; } for (k=0;k 1 && 1 != sscanf(argv[1],"%lf",&vval)) exit( printf("usage: %s [ln_minimal_number [at_least_d]]\n",argv[0]), 1); if (argc > 2 && (1 != sscanf(argv[2],"%lf",&dd) || dd <= 0.0)) exit( printf("usage: %s [ln_minimal_number [at_least_d]]\n",argv[0]), 1); for (i=0;i 2*(unsigned)(lnp[n]/lnp[i])) i++; if (i==n) n++; en= e[i]+1; for (j=0;j<=i;j++) { val -= e[j]*lnp[j]; d /= e[j]+1; e[j]=en; if ((en+1)*lnp[j] < lnp[n-1]) e[j]= lnp[n-1]/lnp[j]; val += e[j]*lnp[j]; d *= e[j]+1; } if (val > vval && en==1) goto done; i++; } while (val > vval); if (val > last && d > dl*(1.0+1e-12)) { dd= d; vval= val; nn=n; for (i=0;i