A354048 a(n) is the largest number of distinct integer-sided right triangles in which some n-digit number can appear as the length of a side.
2, 14, 68, 203, 476, 1421, 3293, 7910, 20060, 39509, 89324, 206711, 442907, 803924, 1722464, 3198608, 6820523, 13434254, 27901259, 50222267
Offset: 1
Examples
a(2)=14 because there exist 14 distinct integer-sided right triangles with the 2-digit number 60 as the length of a side, i.e., (11,60,61), (25,60,65), (32,60,68), (36,48,60), (45,60,75), (60,63,87), (60,80,100), (60,91,109), (60,144,156), (60,175,185), (60,221,229), (60,297,303), (60,448,452), and (60,899,901), and no 2-digit number is the length of a side of more than 14 distinct integer-sided right triangles.
Programs
-
Python
from sympy import factorint def s(n): f=factorint(n) d, q=(list(f.keys()), list(f.values())) (a, b, c, x)=(0, 1, 1, 0) if(d[0]==2): a, x=(0, 1) if q[0]>1: a=q[0]-1 for p in range(x, len(d)): b*=(1+2*q[p]) if d[p]%4==1: c*=(1+2*q[p]) return((b-1)//2+a*b+(c-1)//2) def a(n): max=0 for i in range(1+10**(n-1), 10**n): if s(i)>max: k,max=(i,s(i)) return(n,[k,max]) for i in range(1,6): print (a(i)) # (thanks to Zhao Hui Du for help in the derivation of this function)