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

Home > Numbers
Counting ARATs (Posted on 2016-09-07) Difficulty: 3 of 5
Let (a, b, c) denote a triplet of distinct integers in an ascending order.
If a2+ b2=c2+1
or if
a2+ b2=c2- 1
we will call such a triplet an ARAT (since it represents an almost-right-angle triangle) .
(4,8,9) is such a triplet.

How many ARATs are there, provided c<1,000,000?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts programming mistake; also need faster computer/programming language | Comment 1 of 4
The following program took about 2 hours to find the number of such triplets with c <= 100,000.  Theoretic considerations say that the time should be proportional to the square of the sought size limit, so I would suspect going all the way to a million would take 200 hours of computer time.

For c <= 100,000 the erroneous count (see below for the programming error) is 411,410.

DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 
 For tot = 1 To 141422
   For a = 1 To tot / 2
    DoEvents
     b = tot - a
     a2 = a * a: b2 = b * b
     c2 = a2 + b2
     sr = Int(Sqr(c2) + 0.5)
     If Abs(sr * sr - c2) = 1 And sr <= 100000 Then
       'Text1.Text = Text1.Text & a & Str(b) & Str(sr) & crlf
       ct = ct + 1
       If ct Mod 10000 = 0 Then Text1.Text = Text1.Text & Str(ct) & Str(tot) & "    "
     End If
   Next
 Next
 
 
 
 Text1.Text = Text1.Text & crlf & ct & " done"
  
End Sub


The pairs of numbers below, before the final count, show, every time the count reaches a multiple of 10,000, the value of a+b (the total of which is the order in which the triplets are found, and within that, the order of increasing a).

 10000 3930     20000 7388     30000 10718     40000 13963     50000 17133     60000 20275     70000 23373     80000 26427     90000 29458     100000 32489     110000 35484     120000 38441     130000 41399     140000 44338     150000 47271     160000 50181     170000 53090     180000 55967     190000 58859     200000 61708     210000 64560     220000 67421     230000 70251     240000 73094     250000 75905     260000 78733     270000 81553     280000 84360     290000 87165     300000 89941     310000 92718     320000 95511     330000 98255     340000 101411     350000 105312     360000 109421     370000 113787     380000 118436     390000 123631     400000 129753     410000 138528    


411410 done


And I see I made a mistake: the integers are not all distinct.  I'll rerun. Most of the bad cases are b=c and a=1. Asterisks mark the cases where a^2 + b^2 < c^2 (by 1 of course).

1 1 1     
1 2 2     
1 3 3     
2 2 3     *
1 4 4     
1 5 5     
1 6 6     
1 7 7     
1 8 8     
1 9 9     
5 5 7     
1 10 10     
4 7 8     
1 11 11     
4 8 9     *
1 12 12     
1 13 13     
1 14 14     
1 15 15     
1 16 16     
8 9 12     
1 17 17     
7 11 13     
1 18 18     
1 19 19     
1 20 20     
1 21 21     
1 22 22     
6 17 18     
1 23 23     
6 18 19     *
11 13 17     
12 12 17     *
1 24 24     
10 15 18     
1 25 25     
1 26 26     
1 27 27     
9 19 21     
1 28 28     
1 29 29     
1 30 30     
14 17 22     
1 31 31     
13 19 23     
1 32 32     
1 33 33     
1 34 34     
1 35 35     
1 36 36     
1 37 37     
17 21 27     
1 38 38     
8 31 32     
16 23 28     
1 39 39     
8 32 33     *
11 29 31     
1 40 40     
15 26 30     
1 41 41     
1 42 42     
1 43 43     
1 44 44     
14 31 34     
20 25 32     
1 45 45     
19 27 33     
1 46 46     
1 47 47     
18 30 35     *
1 48 48     
1 49 49     
1 50 50     
17 34 38     
1 51 51     
23 29 37     
1 52 52     
22 31 38     
1 53 53     
13 41 43     
1 54 54     
1 55 55     
1 56 56     
16 41 44     
1 57 57     
29 29 41     
1 58 58     
10 49 50     
26 33 42     
1 59 59     
10 50 51     *
25 35 43     
1 60 60     
1 61 61     
19 43 47     
1 62 62     
1 63 63     
23 41 47     
1 64 64     

  Posted by Charlie on 2016-09-07 10:23:17
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information