Steven Stadnicki suggested in a comment that I post the following as a question.
The golden ration $\phi$ is given by $$\phi = \frac{1+\sqrt{5}}{2} \approx 1.618033988.$$
A rational approximation is given by $$\frac{987}{610} \approx 1.618032787.$$
This yields the following pandigital formulas: $$\frac{4 * 3 + 975}{\left(8 + 2\right) * 61}$$ $$\frac{985 + 2}{1 + 7 * \left(6 + {3}^{4}\right)}$$ $$\frac{5 + 984 - 2}{\left(7 + 3\right) * 61}$$ $$\frac{987}{2 + 1 + \left({5}^{4}\right) - \left(6 * 3\right)}$$ $$\frac{7 * \left(98 + 43\right)}{\left(61 * 5\right) * 2}$$
Is there another pandigital rational representation that yields a higher number of accurate digits?
The same question may be asked for the base of the natural logarithm $e$: $$e\approx 2.718281828.$$ A rational approximation is $$\frac{1457}{536}\approx 2.718283582.$$ It produces the following pandigital formulas: $$\frac{31 * \left(5 + 42\right)}{\left(76 - 9\right) * 8}$$ $$\frac{\left(\left({3}^{6}\right) * 2\right) - 1}{\left({5}^{4}\right) - \left(97 - 8\right)}$$ $$\frac{\left(6 * \left({3}^{5}\right)\right) - 1}{7 + {\left(\left(8 * 4\right) - 9\right)}^{2}}$$ $$\frac{1 + \left(6 * \left({3}^{5}\right)\right) - 2}{\left(9 * 7 + 4\right) * 8}$$ $$\frac{31 * \left(8 * 5 + 7\right)}{{2}^{9} + 6 * 4}$$ $$\frac{5 + \left(\left({9}^{3}\right) * 2\right) - 6}{8 * \left(71 - 4\right)}$$ $$\frac{31 * \left(\left(8 * 7\right) - 9\right)}{542 - 6}$$ As before we ask for a better rational approximation that produces a higher precision.
Furthermore (see this post) we ask for a more sophisticated non-trivial algorithm to compute these. I was able to obtain an improvement of the running time by a factor of thirty by re-coding the Maple algorithm from the other post in C, including quite a few ideas that are of use to the combinatorics programmmer, like the representation of sets by bit strings or the enumeration of the permutations of a list using the factorial number system. Happy computing! (Another observation is that with the five operations and concatenation at our disposal there are probably threshold values for numerator and denominator of the rational approximations from the continued fraction where we can perhaps give a proof that they cannot be attained.)
#include <stdio.h> #include <stdlib.h> #include <assert.h> int blog(int n) { assert(n >= 0); int res = -1; while(n>0){ n >>= 1; res++; } return res; } int fact(int n) { assert(n >= 0); if(n<2) return 1; return n*fact(n-1); } long ipow(int m, int n) { assert(n >= 0); if(n==0) return 1; if(n==1) return m; long r = (n%2 ? ipow(m, (n-1)/2) : ipow(m, n/2)); return (n%2 ? m*r*r : r*r); } struct { int min, max; } searchints[] = { {1, 50}, {100, 120}, {340, 360}, {-1, -1} }; inline int access(int val){ int interval = 0, offs = 0; while(searchints[interval].min !=-1){ int min = searchints[interval].min; int max = searchints[interval].max; if(val >= min && val <= max){ return offs + val-min; } offs += max-min+1; interval++; } return -1; } int entcount = -1; typedef struct { short leaf; long val; char plain[128]; char latex[256]; } expr; expr *memo[1<<9]; expr *makememo(void) { expr *ents = (expr *)malloc(entcount*sizeof(expr)); int ind; for(ind=0; ind<entcount; ind++){ ents[ind].val = -1; } return ents; } expr *repr(int subsind) { if(memo[subsind] != NULL){ return memo[subsind]; }; int elcount = 0; int elements[9+1]; int pos, bitpat = subsind; for(pos=0; pos<9; pos++){ if(bitpat & 1 == 1){ elements[elcount++] = pos+1; } bitpat >>= 1; } elements[elcount] = -1; expr *res = makememo(); int idx; if(elcount == 1){ idx = access(elements[0]); res[idx].leaf = 1; res[idx].val = elements[0]; sprintf(res[idx].plain, "%d", elements[0]); sprintf(res[idx].latex, "%d", elements[0]); memo[subsind] = res; return res; } int count = 0; if(elcount >= 2 && elcount <= 4){ int perm[9+1], el; for(pos=0; pos<elcount; pos++){ perm[pos] = elements[pos]; } int upper = fact(elcount); for(pos=0; pos<upper; pos++){ idx = pos; int el; for(el=elcount; el>0; el--){ int targ = idx % el; int tmp = perm[targ]; perm[targ] = perm[el-1]; perm[el-1] = tmp; idx /= el; } } char buf[9+1], *digits = "123456789"; for(idx=0; idx<elcount; idx++){ buf[idx] = digits[perm[idx]-1]; } buf[idx] = 0; int numval; sscanf(buf, "%d", &numval); idx = access(numval); if(idx != -1){ res[idx].leaf = 1; res[idx].val = numval; sprintf(res[idx].plain, "%d", numval); sprintf(res[idx].latex, "%d", numval); count++; } } int subsubind; for(subsubind=1; subsubind<(1<<elcount)-1; subsubind++){ int leftel[9+1], rightel[9+1], leftpos=0, rightpos=0; bitpat = subsubind; for(pos=0; pos<elcount; pos++){ if(bitpat & 1 == 1){ leftel[leftpos++] = elements[pos]; } else{ rightel[rightpos++] = elements[pos]; } bitpat >>= 1; } int lidx = 0, ridx = 0, innerpos; for(innerpos=0; innerpos<leftpos; innerpos++){ lidx += 1<<(leftel[innerpos]-1); } for(innerpos=0; innerpos<rightpos; innerpos++){ ridx += 1<<(rightel[innerpos]-1); } expr *lres = repr(lidx), *rres = repr(ridx); if(count>=entcount){ continue; } int lpos, rpos; for(lpos=0; lpos<entcount; lpos++){ for(rpos=0; rpos<entcount; rpos++){ expr exl = lres[lpos], exr = rres[rpos]; int newval, newind; if(exl.val != -1 && exr.val != -1){ char plainl[256], plainr[256]; sprintf(plainl, (exl.leaf ? "%s" : "(%s)"), exl.plain); sprintf(plainr, (exr.leaf ? "%s" : "(%s)"), exr.plain); char latexl[256], latexr[256]; sprintf(latexl, (exl.leaf ? "%s" : "\\left(%s\\right)"), exl.latex); sprintf(latexr, (exr.leaf ? "%s" : "\\left(%s\\right)"), exr.latex); newval = exl.val + exr.val; if((newind = access(newval))!=-1){ res[newind].leaf = 0; res[newind].val = newval; sprintf(res[newind].plain, "%s + %s", exl.plain, exr.plain); sprintf(res[newind].latex, "%s + %s", exl.latex, exr.latex); count++; } newval = exl.val - exr.val; if(newval>0 && (newind = access(newval))!=-1){ res[newind].leaf = 0; res[newind].val = newval; sprintf(res[newind].plain, "%s - %s", plainl, plainr); sprintf(res[newind].latex, "%s - %s", latexl, latexr); count++; } if(exl.val>1 && exr.val>1){ newval = exl.val * exr.val; if((newind = access(newval))!=-1){ res[newind].leaf = 0; res[newind].val = newval; sprintf(res[newind].plain, "%s * %s", plainl, plainr); sprintf(res[newind].latex, "%s * %s", latexl, latexr); count++; } } if(exr.val>1 && (exl.val % exr.val) == 0){ newval = exl.val / exr.val; if((newind = access(newval))!=-1){ res[newind].leaf = 0; res[newind].val = newval; sprintf(res[newind].plain, "%s / %s", plainl, plainr); sprintf(res[newind].latex, "\\frac{%s}{%s}", exl.latex, exr.latex); count++; } } if(exl.val>1 && exr.val>1 && exr.val*blog(exl.val)<32){ newval = ipow(exl.val, exr.val); if((newind = access(newval))!=-1){ res[newind].leaf = 0; res[newind].val = newval; sprintf(res[newind].plain, "%s ^ %s", plainl, plainr); sprintf(res[newind].latex, "{%s}^{%s}", latexl, exr.latex); count++; } } } } } } memo[subsind] = res; return res; } int main(int argc, char **argv) { long p, q; if(argc!=3){ fprintf(stderr, "usage: %s <p> <q>\n", argv[0]); exit(-1); } sscanf(argv[1], "%ld", &p); sscanf(argv[2], "%ld", &q); if(p<1 || q<1){ fprintf(stderr, "positive integers please, got %ld and %ld\n", p, q); exit(-2); } int ind = 0, ent; entcount = 0; while(searchints[ind].min != -1){ entcount += searchints[ind].max-searchints[ind].min+1; ind++; } for(ind=0; ind<(1<<9); ind++){ memo[ind] = NULL; } for(ind=1; ind<(1<<9)-1; ind++){ expr *leftres = repr(ind), *rightres = repr((1<<9)-1-ind); int idxleft = access(p), idxright = access(q); if(idxleft != -1 && idxright != -1){ expr left = leftres[idxleft]; expr right = rightres[idxright]; if(left.val != -1 && right.val != -1){ printf("(%s) / (%s); %d / %d; %.15lf\n", left.plain, right.plain, p, q, (double)left.val/(double)right.val); printf("\\frac{%s}{%s}\n", left.latex, right.latex); } } } return 0; }