This is a companion piece of Largest Ten Digit Powers. The codes are almostly same,with a few changes only.
- Functionbefit(ByValsAsString,ByValnumAsLong)AsBoolean'tellifastringscontainalldigit(0-9)forjustnumtimes
- Dimb(9)AsLong,tAsLong
- befit=True'init
- IfLen(s)<>10*numThenbefit=False:ExitFunction
- Fori=1ToLen(s)
- t=Val(Mid(s,i,1))
- b(t)=b(t)+1
- Ifb(t)>numThenbefit=False:ExitFunction
- Next
- EndFunction
- Functionmypower(ByValnumAsCurrency,ByValpowerAsLong)AsString'UDFtocalculatepowersofa10-digitnumber
- Dimb(),temp
- ReDimb(1To2*power)
- ReDims(1To2*power)
- 'Thelasttwoelementoftheresult,i.e.numitself
- b(2*power-1)=Val(Left(num,5))'init
- b(2*power)=Val(Right(num,5))'init
- Fori=2Topower
- temp=0
- Forj=2*powerTo1Step-1
- temp=b(j)*num+temp
- b(j)=Format(Val(Right(temp,5)),"00000")'100000adic
- temp=Int(temp/10^5)
- Next
- Next
- mypower=Join(b,"")'Thefinalresult
- EndFunction
- PrivateSubCommand1_Click()
- DimindexAsLong,jAsCurrency,sAsString
- Index = CLng(InputBox("Please enter an integer within 1-30", "Info", 2))
- Forj=3*Int(10^(10-1/index)/3)To 9999999999# Step3'ntimes0-9mustbedivisibleby3
- DoEvents
- s=mypower(j,index)'theresult
- Ifbefit(s,index)Then'scontains0-9eachforindextimes
- Open"c:\"& index &".txt"ForBinaryAs#1'Outputtoatextfile
- Put#1,,j&"^"&index&"="&s'Printtheresult
- Close#1
- EndIf
- End
- Next
- EndSub
Since it have to enum a mount of 10-digit numbers,I compiled it to an windows applicationran and run the program in 4 PCs with different index , I've got the first 18 numbers till now(Numbers of otherindex: are still running):
1023456789^1=1023456789
3164252736^2=10012495377283485696
4642110594^3=100033726751278963952981464584
5623720662^4=1000218682348975505736229176987914443536
6312942339^5=10026725211153654390647841773200637448888932595699
6813614229^6=100061094057342858338669213648989907272573726634945455718121
7197035958^7=1000174338562286975299093890542029857149684613078516674136378324154752
7513755246^8=10159126159182043894548182772732556416094700698382830384251729403677604659937536
7747685775^9=100588420220833267470480529930325768811210496267095564714166268334749167599758148193359375
7961085846^10=1022640693192423918177472081495528045704001257405737138779536432199258656683133613589649088809624576
8120306331^11=10122704098280838738172663899155037525077864931542099359740473382958509846605210754479164591281362667243664131
8275283289^12=103132237398088685094148078064865552159324856064887274905478374353291741047910665437929791704128950573536662022369961121
8393900487^13=1026903443699705827527536011508380184886293234662850067608075167429132223154193162185649469905953603798419838589572701415774734247
8626922994^14=12646865508335605494843998794325485046341519468022708717028070547609519671202542318242559727117330589393633676024803151817278793689169412096
8594070624^15=103034762496243931091455752211526072992924547837934076638161515185979607268158486084352819994377954771846242628607531128031703303609805578845368090624
8691229761^16=1059984945135973085116625441940958734567890938937942910046410302827750560860737374626331724228885721853160790705924439371252226476405367618058329962361885148161
8800389678^17=11390226244546010693396746234792908564082582116481391247700038553190598561445998201373250115023954747487287071642058604917672993155873874536685736231662530396074892197888
8807854905^18=101780066705166236878346559130256930813111042299349121630146805870467163387920998553309748134869974589535455566056948852225484079291126292377577073478873342409711802829742431640625
Fortunately,I got a bigger number ,it appears when index=26:
9160395852^26=10227518575824412357774543428738315554963808756628545271950823008826278208489241129245927140719397161241846684623365292876389607982052697908581050074069519609796563228194931373316940301945115333795271107340007386839663447290510415078963123506544174796388696064 |
Since (10n)!*(10^10-10^(10-1/n))/((n!)^10 * 10^((10*n)-10^(10*n-1)) =0.31691419
That means it should exists 0.3169 numbers whose 26th power contains all digit for 26 times.But it exists!!! It's realy a wonder!!!