All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 LCM and GCD Sequence (Posted on 2016-04-29)
Find all pairs (X,Y) of positive integers such that:
gcd(X,Y), lcm(X,Y)-1 and XY (in this order) are in arithmetic sequence.

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 probable solution (spoiler) Comment 1 of 1
DefDbl A-Z
Dim crlf\$

Form1.Visible = True

Text1.Text = ""

crlf = Chr\$(13) + Chr\$(10)

l10 = Log(10)
For tot = 3 To 9999999
For x = 1 To tot / 2
DoEvents
y = tot - x
lpwr = Log(x) * y / l10
If lpwr < 16 Then
p = Int(10 ^ lpwr + 0.5)
g = gcd(x, y)
lcm = x * y / g
If p + g = 2 * (lcm - 1) Then
Text1.Text = Text1.Text & x & Str(y) & "    " & g & Str(lcm - 1) & Str(p) & crlf
End If
End If
h = y: y = x: x = h
lpwr = Log(x) * y / l10
If lpwr < 16 Then
p = Int(10 ^ lpwr + 0.5)
g = gcd(x, y)
lcm = x * y / g
If p + g = 2 * (lcm - 1) Then
Text1.Text = Text1.Text & x & Str(y) & "    " & g & Str(lcm - 1) & Str(p) & crlf
End If
Else
Exit For
End If
h = y: y = x: x = h
Next
Next

Text1.Text = Text1.Text & crlf & " done"

End Sub

Function gcd(a, b)
x = a: y = b
Do
q = Int(x / y)
z = x - q * y
x = y: y = z
Loop Until z = 0
gcd = x
End Function

finds only

`x y    sequence1 2    1 1 13 1    1 2 33 2    1 5 9`

 Posted by Charlie on 2016-04-29 11:30:46

 Search: Search body:
Forums (1)