Largest Ten Digit Powers

The idea was Inspirated from the following link: HomogeneousSquare Numbers (Provided by mathe, http://bbs.emath.ac.cn/thread-78-1-1.html

Look at the 10-digit number 9876543210,it's the largest ten-digit number containedall ten digits(0-9) for just once.

Then let's look at another ordinary 10-digit number: 3175462089.But Do you know 3175462089^2=10083559478676243921 and the result contains all ten digits(0-9) for twice!

This is notan accidental phenomenon.

In fact,As a number with 10*n digits, it perhaps has all ten digits(0-9) for n times,the probability is

(10n)!/((n!)^10 * 10^((10*n)-10^(10*n-1))

As the following list:

P(1)=4.03E-04
P(2)=2.64E-05
P(3)=4.87E-06
P(4)=1.43E-06
P(5)=5.46E-07
P(6)=2.47E-07
P(7)=1.26E-07
P(8)=7.00E-08
P(9)=4.17E-08
P(10)=2.62E-08
P(11)=1.72E-08
P(12)=1.17E-08
P(13)=8.20E-09
P(14)=5.90E-09
P(15)=4.34E-09
P(16)=3.26E-09
P(17)=2.48E-09
P(18)=1.93E-09
P(19)=1.52E-09
P(20)=1.21E-09

If the number is also powers of some 10-digit number,the probability will be more less. For any 10-digit number x, if it's nth power is a 10*n digit number,that means:

x^(n)>10^(10n-1)

which is equivalent to x>=10^(10-1/n)

Therefor,the numbers count maybe P(n)*(10^10-10^(10-1/n)),as the following list shows:

Count(1)=3628800
Count(2)=180506.8
Count(3)=26118.07
Count(4)=6257.858
Count(5)=2014.172
Count(6)=787.0462
Count(7)=352.7788
Count(8)=175.1474
Count(9)=94.1162
Count(10)=53.86485
Count(11)=32.45481
Count(12)=20.40871
Count(13)=13.30534
Count(14)=8.946367
Count(15)=6.178346
Count(16)=4.367553
Count(17)=3.141511
Count(18)=2.317495
Count(19)=1.734825
Count(20)=1.315864

It means maybe exists an 200-digit number which is 20th power of a 10-digit number and it contains all 10 digit for 20 times Respectivly!


  1. Functionbefit(ByValsAsString,ByValnumAsLong)AsBoolean'tellifastringscontainalldigit(0-9)forjustnumtimes
  2. Dimb(9)AsLong,tAsLong
  3. befit=True'init
  4. IfLen(s)<>10*numThenbefit=False:ExitFunction
  5. Fori=1ToLen(s)
  6. t=Val(Mid(s,i,1))
  7. b(t)=b(t)+1
  8. Ifb(t)>numThenbefit=False:ExitFunction
  9. Next
  10. EndFunction
  11. Functionmypower(ByValnumAsCurrency,ByValpowerAsLong)AsString'UDFtocalculatepowersofa10-digitnumber
  12. Dimb(),temp
  13. ReDimb(1To2*power)
  14. ReDims(1To2*power)
  15. 'Thelasttwoelementoftheresult,i.e.numitself
  16. b(2*power-1)=Val(Left(num,5))'init
  17. b(2*power)=Val(Right(num,5))'init
  18. Fori=2Topower
  19. temp=0
  20. Forj=2*powerTo1Step-1
  21. temp=b(j)*num+temp
  22. b(j)=Format(Val(Right(temp,5)),"00000")'100000adic
  23. temp=Int(temp/10^5)
  24. Next
  25. Next
  26. mypower=Join(b,"")'Thefinalresult
  27. EndFunction
  28. PrivateSubCommand1_Click()
  29. DimindexAsLong,jAsCurrency,sAsString
  30. Forindex=2To20
  31. Forj=9999999999#ToInt(10^(10-1/index))+1Step-3'ntimes0-9mustbedivisibleby3
  32. DoEvents
  33. s=mypower(j,index)'theresult
  34. Ifbefit(s,index)Then'scontains0-9eachforindextimes
  35. Open"c:\9876543210.txt"ForAppendAs#1'Outputtoatextfile
  36. Print#1,,j&"^"&index&"="&s'Printtheresult
  37. Close#1
  38. EndIf
  39. ExitFor'Loopfornextindex
  40. Next
  41. Next
  42. End
  43. EndSub

After compiled to an windows application,I run it on my server.

I have nearly forgot this matter for weeks,until I check my server yesterday and found it had found all 19 numbers!!!

It's very regrettable that I didn't record how much time it had spent,but I'm sure it's a long long time.

9876543210^1=9876543210
9994363488^2=99887301530267526144
9999257781^3=999777350826262438514680310541
9999112926^4=9996452176112247953600451338048028738576
9995722269^5=99786296361563700071158420714348803519252748562349
9999409158^6=999645547160015336274628182310921018733487079056876529825344
9998033316^7=9986241331814640079403238828137256759073328564645514771700992186925056
9993870774^8=99510712519054222193756280069640230763318630377985744542154567431406398882898176
9986053188^9=987517666680543930766059857014622826299032148073589551128320546375470193081173239927144448
9964052493^10=9646284541180668647853045532609637216734529351533998706101289748703315217504814796372928287190050249
9975246786^11=97310597130133980670422681628044478694065307086053298652781287655317998455992203115833251796467214044294875136
9966918135^12=961016166312066893513472012121821737565035827990824578484953814364753372689494445678867050402281197294038357597900390625
9938689137^13=9231630003532835311535099861494753310010497890625116796767362484379160844596809149170583832020286172155768859756828744224452427697
9998781633^14=99829563636241594870366548180779984151639552440155484381378402612266544305041741027295700865830638080210963191736521977268890577273924313729
9813743148^15=754258663307019068839965669752324922658571968579063043894900422396192340253775534984114684870355827724406475630117185321610231849000884165197778911232
9970902252^16=9544459510773680273631106962869012958814971380179649996530655102703425012970782501892954893350678844246143743337231505272840657256408301677884814622921678913536
9740383767^17=63943022360933860893515860910930834864744564453182949657396974612504217056235809174380683936130475008058248971227569792127751904695771118682411655757034082242563182187927
9829440591^18=733699864215610114780902995185639178779529420237628437612828585014749365806991221630255673403360717773074363761194987916402410826486269582245985803425461351754040398703480055853921
9873773268^19=7855608929517570243129124902383848671305376350326251297158422748900643175003663401660063412051329789580670429726512989648355976426934188517557270873647143849124881043569143877856149091909632
9985819785^20=97201838812273614690835449227859857176624728062825456640726094604701134159466873538419451357136087100336496709724979474384310924926794015773915683917180391558815561723889985220630315208530426025390625

Thanks medie2005 for helping me to calculate the probability.See details in the following link:

http://topic.csdn.net/u/20081130/13/16a4ef60-2345-4a5f-81fb-096212e07b03.html

你可能感兴趣的:(windows,.net,J#,idea,bbs)