CodePudding user response:
The number of positive integer n if it square tail, is called the n number of isomorphism, for example, 6 is the square of the end of the number 36, 76 is the square of the end of the number 5776, number 6 and 76 are isomorphic,Quote from https://wenda.so.com/q/1365738830066656? src=https://bbs.csdn.net/topics/300
CodePudding user response:
Write good, is very simple, just use string comparison:
Private Sub Form_Load ()
Dim As Long I
For I=1 To 1000
Dim p As Long
P=the I ^ 2
Dim ilen As Integer
Ilen=Len (CStr (I))
If Right (CStr (p), ilen)=CStr (I) Then
The Debug. Print I
End the If
Next
End Sub
Run the example:
Download address:
Link: https://pan.baidu.com/s/1vdfn1SHTMs4n-ZpCeyZxqQ
The extracted code: x7a0
CodePudding user response:
Pure mathematics view, if a is a k digits, for a number of isomorphism said a ^ 2 - a is a multiple of 10 ^ k, so a * (a - 1) is a multiple of 2 and 5 ^ ^ k kSo a and a - 1 a is 2 ^ k multiples, another is in multiples of 5 ^ k
Public Sub ListIsoNum (n As an Integer)
Dim j As Integer
Dim As Integer k
The Debug. Print 1
For k=1 To n
For j=(2 ^ (k - 1) \ 5 + 1) - 1 To 2 ^ k
If (j * ^ 5 k - 1) Mod 2 ^ (k)=0 Then
The Debug. Print (j * ^ 5 k)
End the If
If (j * ^ 5 k + 1) Mod 2 ^ (k)=0 Then
The Debug. Print (j * ^ 5 k + 1)
End the If
Next j
Next k
End Sub
But because the VB range, can handle integer n with 10 generations into the overflow will occur and