\\ Computes successive terms of the sequence. Does not filter out bad results -- if \\ multiple lines of the form \\ n B \\ occur for a given n, take only the smallest B. When the script finishes (actually, \\ it is sufficient to wait for test_digits to finish its run), no more n will be output. find(lim)={ print("3 11"); print("4 78"); my(r=4); for(d=6, ceil(log(lim)/log(3)), r=test_digits(d, r) ); }; \\ Search for n-trit solutions a(r) with r >= oldRecord. Iterate through members of \\ A154314, though not in order. \\ Returns the current record, either the old record if no new terms were found or the \\ greatest height found so far otherwise. test_digits(n,oldRecord)={ my(Q2=3^n\2,Q1=Q2-3^(n-1),x='x,t,g,r=oldRecord); for(i=2^(n-1),2^n-1, t=subst(Pol(binary(i)),x,3); \\ Digits 0,1 g=gb(t); if(g > oldRecord, print(g" "t); r=max(g, r)); \\ Digits 0,2 g=gb(2*t); if(g > oldRecord, print(g" "2*t); r=max(g, r)); \\ Digits 1,2 with a leading 1 g=gb(t+Q1); if(g > oldRecord, print(g" "t+Q1); r=max(g, r)); \\ Digits 1,2 with a leading 2 g=gb(t+Q2); if(g > oldRecord, print(g" "t+Q2); r=max(g, r)); ); r }; \\ Finds the greatest base k>3 such that n is k-pandigital but not 4-, 5-, ..., (k-1)-pandigital. \\ If no such k exists, return 0. gb(n)={ if(#Set(digits(n,4))==4,return(4)); \\ Don't bother to compute the lambertw if the number is 4-pandigital. for(b=5,log(n)\lambertw(log(n))+1, if(#Set(digits(n,b))==b,return(b)) ); 0 };