Digit-reversible Pythagorean triplet

Number Theory Level pending

What is the smallest positive integer A such that there is a Pythagorean triplet (A,B,C) with A<B<C and the digits of B are the same as the digits of A but in reverse order?


The answer is 88209.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Fredric Kardon
Nov 26, 2017
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Python 3 program

import math

def listDigits(n):
    digits = []
    test = n
    while test > 0:
        testNew = int(test/10)
        digits.append(test - testNew * 10)
        test = testNew
    return digits

def reverseDigits(n):
    digitsIn = listDigits(n)
    power = 1
    R = 0
    while len(digitsIn) > 0:
        L = len(digitsIn)
        R += digitsIn[L - 1] * power
        power *= 10
        digitsIn = digitsIn[:L-1]
    return R

found = False
A = 1
while not found:
    B = reverseDigits(A)
    Csquared = A* A + B * B  
    C = int(math.sqrt(Csquared))
    if Csquared == C * C:
        print(A, B, C)
        found = True
    A += 1

Nice problem! Turns out this is in the OEIS here . No mention of if there are infinitely many such numbers.

Chris Lewis - 1 year, 7 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...