Get prime numbers nearby a number less than 10^10

来源:互联网 发布:杭州阿里巴巴淘宝城 编辑:程序博客网 时间:2024/04/28 11:47

For any given number less than 10^10,you can get prime numbers from 10000 numbers nearby it by the following codes:

 

  1. Private Sub Command1_Click()
  2. Debug.Print primes10000(987654321)
  3. End Sub
  4. Function primes10000(ByVal n) As String
  5. If n > 9999999999# Then MsgBox n & " is too large,try a number less than 10^10"Exit Function
  6. n = n - Val(Right(n, 5)) Mod 10000
  7. Dim s As String, j
  8. With CreateObject("Msxml2.XMLHTTP")
  9. For j = n To n + 9999 Step 5000
  10. .Open "GET""http://www.prime-numbers.org/prime-number-" & j & "-" & j + 4999 & ".htm"False
  11. .Send
  12. s = s & Split(Split(.responseText, "<pre>")(1), "<br></pre>")(0)
  13. Next
  14. End With
  15. primes10000 = s
  16. End Function

It returns:

 

987650009   987650033   987650099   987650119  
987650137   987650159   987650161   987650197  
987650201   987650227   987650231   987650233  
987650239   987650263   987650311   987650317  
987650341   987650369   987650371   987650387  
987650401   987650413   987650437   987650453  
987650537   987650561   987650563   987650597  
987650603   987650639   987650641   987650663  
987650687   987650689   987650701   987650749  
987650753   987650759   987650801   987650803  
987650863   987650893   987650897   987650929  
987650971   987650977   987650987   987651013  
987651019   987651037   987651043   987651053  
987651079   987651089   987651107   987651143  
987651157   987651169   987651199   987651229  
987651253   987651263   987651281   987651283  
987651299   987651307   987651311   987651317  
987651319   987651359   987651367   987651403  
987651421   987651433   987651437   987651473  
987651517   987651557   987651607   987651631  
987651647   987651667   987651689   987651727  
987651761   987651773   987651827   987651853  
987651871   987651883   987651887   987651919  
987651923   987651991   987651997   987652019  
987652093   987652123   987652139   987652147  
987652163   987652189   987652199   987652241  
987652249   987652273   987652291   987652301  
987652331   987652339   987652373   987652399  
987652409   987652429   987652459   987652469  
987652481   987652483   987652493   987652511  
987652513   987652531   987652537   987652541  
987652571   987652613   987652619   987652703  
987652709   987652747   987652751   987652763  
987652781   987652793   987652801   987652817  
987652823   987652837   987652871   987652873  
987652879   987652903   987652909   987652937  
987652969   987652993   987653011   987653053  
987653057   987653071   987653081   987653113  
987653129   987653201   987653209   987653237  
987653263   987653287   987653291   987653299  
987653323   987653341   987653353   987653371  
987653411   987653417   987653449   987653477  
987653479   987653489   987653567   987653581  
987653587   987653591   987653599   987653647  
987653677   987653701   987653717   987653731  
987653753   987653789   987653819   987653837  
987653861   987653921   987653959   987653983  
987653999   987654047   987654071   987654103  
987654113   987654121   987654133   987654137  
987654139   987654149   987654163   987654167  
987654179   987654197   987654211   987654223  
987654251   987654259   987654263   987654281  
987654299   987654319   987654323   987654337  
987654347   987654359   987654361   987654377  
987654379   987654383   987654419   987654439  
987654443   987654461   987654463   987654467  
987654511   987654539   987654581   987654583  
987654601   987654607   987654611   987654673  
987654677   987654791   987654793   987654803  
987654821   987654869   987654883   987654901  
987654923   987654929   987654959   987654961  
987654977   987654989  
987655013   987655037   987655043   987655099  
987655111   987655127   987655177   987655183  
987655199   987655211   987655219   987655297  
987655303   987655313   987655327   987655367  
987655373   987655387   987655391   987655399  
987655423   987655439   987655441   987655447  
987655469   987655483   987655499   987655531  
987655547   987655573   987655597   987655607  
987655609   987655619   987655621   987655637  
987655679   987655717   987655723   987655727  
987655751   987655769   987655787   987655807  
987655831   987655841   987655859   987655931  
987655961   987655969   987655993   987655997  
987656009   987656039   987656057   987656083  
987656099   987656101   987656107   987656129  
987656141   987656149   987656209   987656213  
987656237   987656251   987656269   987656279  
987656323   987656333   987656357   987656381  
987656387   987656441   987656443   987656473  
987656479   987656489   987656491   987656513  
987656557   987656561   987656569   987656603  
987656611   987656617   987656627   987656641  
987656653   987656669   987656707   987656711  
987656713   987656717   987656743   987656767  
987656771   987656779   987656783   987656819  
987656843   987656851   987656863   987656897  
987656909   987656921   987656927   987656933  
987656953   987656977   987657019   987657043  
987657049   987657091   987657149   987657157  
987657199   987657217   987657233   987657257  
987657277   987657299   987657301   987657343  
987657367   987657397   987657431   987657439  
987657443   987657457   987657479   987657481  
987657493   987657509   987657529   987657547  
987657617   987657623   987657673   987657683  
987657709   987657719   987657731   987657757  
987657767   987657821   987657871   987657877  
987657883   987657887   987657899   987657907  
987657997   987658037   987658073   987658103  
987658117   987658123   987658193   987658201  
987658213   987658219   987658223   987658241  
987658253   987658261   987658267   987658283  
987658291   987658313   987658327   987658337  
987658349   987658379   987658409   987658411  
987658421   987658439   987658447   987658487  
987658489   987658499   987658547   987658579  
987658621   987658631   987658733   987658739  
987658769   987658783   987658823   987658883  
987658907   987658913   987658927   987658933  
987658937   987658949   987658951   987658981  
987659009   987659011   987659017   987659041  
987659051   987659059   987659063   987659129  
987659161   987659191   987659207   987659213  
987659221   987659227   987659317   987659347  
987659369   987659377   987659381   987659401  
987659419   987659423   987659443   987659461  
987659503   987659513   987659531   987659549  
987659567   987659581   987659599   987659609  
987659627   987659639   987659669   987659683  
987659689   987659707   987659711   987659713  
987659731   987659737   987659741   987659747  
987659773   987659779   987659801   987659807  
987659867   987659891   987659899   987659903  
987659921   987659971   987659987   987659993

原创粉丝点击