Largest Ten Digit Powers

The idea was Inspirated  from  the following link:  Homogeneous  Square 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 contained  all 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 not an  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. Function befit(ByVal s As StringByVal num As LongAs Boolean 'tell if a string s contain all digit(0-9) for just num times
  2. Dim b(9) As Long, t As Long
  3. befit = True 'init
  4. If Len(s) <> 10 * num Then befit = FalseExit Function
  5. For i = 1 To Len(s)
  6. t = Val(Mid(s, i, 1))
  7. b(t) = b(t) + 1
  8. If b(t) > num Then befit = FalseExit Function
  9. Next
  10. End Function
  11. Function mypower(ByVal num As Currency, ByVal power As LongAs String 'UDF to calculate powers of a 10-digit number
  12. Dim b(), temp
  13. ReDim b(1 To 2 * power)
  14. ReDim s(1 To 2 * power)
  15. 'The last two element of the result,i.e. num it self
  16. b(2 * power - 1) = Val(Left(num, 5)) 'init
  17. b(2 * power) = Val(Right(num, 5)) 'init
  18. For i = 2 To power
  19. temp = 0
  20. For j = 2 * power To 1 Step -1
  21. temp = b(j) * num + temp
  22. b(j) = Format(Val(Right(temp, 5)), "00000"'100000 adic
  23. temp = Int(temp / 10 ^ 5)
  24. Next
  25. Next
  26. mypower = Join(b, ""'The final result
  27. End Function
  28. Private Sub Command1_Click()
  29. Dim index As Long, j As Currency, s As String
  30. For index = 2 To 20
  31. For j = 9999999999# To Int(10 ^ (10 - 1 / index)) + 1 Step -3 'n times 0-9 must be divisible by 3
  32. DoEvents
  33. s = mypower(j, index) 'the result
  34. If befit(s, index) Then 's contains 0-9 each for index times
  35. Open "c:/9876543210.txt" For Append As #1 'Output to a text file
  36. Print #1, , j & "^" & index & "=" & s 'Print the result
  37. Close #1
  38. End If
  39. Exit For 'Loop for next index
  40. Next
  41. Next
  42. End
  43. End Sub

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

原文地址:https://www.cnblogs.com/fengju/p/6336227.html