This is a companion piece of Largest Ten Digit Powers. The codes are almostly same,with a few changes only.
-
Functionbefit(ByValsAsString,ByValnumAsLong)AsBoolean
-
Dimb(9)AsLong,tAsLong
-
befit=True
-
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
-
Dimb(),temp
-
ReDimb(1To2*power)
-
ReDims(1To2*power)
-
-
b(2*power-1)=Val(Left(num,5))
-
b(2*power)=Val(Right(num,5))
-
Fori=2Topower
- temp=0
-
Forj=2*powerTo1Step-1
- temp=b(j)*num+temp
-
b(j)=Format(Val(Right(temp,5)),"00000")
- temp=Int(temp/10^5)
-
Next
-
Next
-
mypower=Join(b,"")
-
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
- DoEvents
-
s=mypower(j,index)
-
Ifbefit(s,index)Then
-
Open"c:\"& index &".txt"ForBinaryAs#1
-
Put#1,,j&"^"&index&"="&s
- 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!!!
分享到:
相关推荐
本人在Clion中的实现的第小k元素,有期望值是O(n)代价的以及醉话情况为O(n)BFPRT算法
Android自定义dimens.xml,适应各种屏幕分辨率,300-450dp
373._Find_K_Pairs_with_Smallest_Sums查找和最小的k对数字【LeetCode单题讲解系列】
Exercise 8: Arrays 1. Write a program that reads ten numbers supplied by the user into a single subscripted array, and then prints out the ... Use the smallest possible array to solve this problem.
代码:// find K-th Smallest Pair Distancepublic int smallestDistancePair(int[] nums
将您的过程解决方案编码到lib/smallest_multiple.rb文件中。 将您的面向对象的解决方案编码到lib/oo_smallest_multiple.rb文件中。 运行learn直到所有RSpec测试通过。 来源 -- 在Learn.co上查看并开始免费学习编码。
AT_code_festival_2017_qualb_f Largest Smallest Cyclic Shift 的 AC 代码
378.Kth_Smallest_Element_in_a_Sorted_Matrix有序矩阵中第K小的元素【LeetCode单
其中利用最小位置值(smallest position value,SPV)规则,使具有连续本质的微粒群算法能直接应用于调度问题,并通过动态调整参数平衡算法的全局搜索和局部搜索的能力。针对微粒群算法容易陷入局部最优的缺陷,利用...
一个用100行代码实现h264格式视频的编码器; 适合想了解参数在NAL中具体写入的同仁;
欧拉公式求长期率的matlab代码最小倍数 构建一个函数,以找到最小的正数,该正数可以被从1...smallest_multiple.js的文件中完成。 使用以下命令npm test : npm test 总共有两个测试。 让他们通过! 来自欧拉计划问题5
这个源代码是一个最小生成树的算法实现,采用的visual c++6.0
usb 通信 基于C8051 单片机代码。
快速示例示例: 用法: git clone " https://github.com/ranmocy/smallest-blogger.git "cd smallest-blogger/examplebundleguard 在浏览器中打开 。帖子标题我们对帖子的元信息使用 YAML 标头,如下所示: ---title...
smallest D j for i D j C 1 to n if AŒi Œsmallest smallest D i exchange AŒj with AŒsmallest The algorithm maintains the loop invariant that at the start of each iteration of the outer for ...
用C++实现的最小生成树的算法,很简单,但对于初学者来说很有用
labview实现两路电压采集。设计一个VI程序,进行两路电压信号采集。一路电压信号的范围0~3.3V, 每隔100ms采一个点,共采集50个点,另一路电压信号的范围为5~10V,采样间隔是50ms,共采集100个点。...
1. Write a program that reads ten numbers supplied by the user into a single subscripted array, and then prints out the average of them. ... Use the smallest possible array to solve this problem.
int smallest; for(int i=0;i;i++){ int smallPos = i; smallest = x[smallPos]; for(int j=i+1;j;j++){ if(x[j]<smallest) { smallPos=j; smallest = x[smallPos]; } } x[smallPos] = x...
关于有向图最小树形图的C代码,供大家参考。