日期:2014-05-18  浏览次数:20594 次

求1000到10000之间的素数,求到素数之后把所求的素数倒过来(如素数1009倒过来是9001),在判断倒过来的数是不是素数?急啊在线等啊!!
我自己的代码,没做完的,倒过来的数没求出来!!
  Dim   t   As   Integer
                Dim   r   As   Integer
                Dim   m   As   Integer
                Dim   n   As   Integer
                Dim   i   As   Integer
                Dim   j   As   Integer
                Dim   y(2000)   As   Integer
                Dim   x   As   Integer
                x   =   0
                For   i   =   1000   To   9999
                        m   =   1
                        For   n   =   2   To   i   /   2   -   1
                                If   i   Mod   n   =   0   Then   m   =   0
                        Next
                        If   m   =   1   Then

                                x   =   x   +   1
                                y(x)   =   i

                        End   If
                Next
                For   x   =   0   To   1061   Step   1
                        For   r   =   4   To   1   Step   -1
                                t   =   0
                                t   =   CInt(Mid(y(x),   r,   1))
                                t   =   t   *   10   ^   (r   -   1)
                                j   =   j   +   t
                                Console.WriteLine(j)
                        Next
                Next

------解决方案--------------------
dim s() as integer ={}
dim count as integer=0
for i a