A269928
Integers n that belong to more Pythagorean triples than preceding integers.
Original entry on oeis.org
1, 3, 5, 12, 15, 24, 40, 48, 60, 120, 240, 360, 420, 720, 840, 1560, 1680, 2520, 3360, 5040, 8400, 9240, 10920, 15120, 18480, 21840, 27720, 32760, 36960, 43680, 55440, 65520, 109200, 110880, 120120, 166320, 196560, 221760, 240240, 360360, 480480, 720720, 1113840
Offset: 1
-
nbpt(n) = {oddn = n/(2^valuation(n, 2)); f = factor(oddn); for (k=1, #f~, if ((f[k,1] % 4) != 1, f[k,2] = 0);); n1 = factorback(f); if (n % 2, (numdiv(n^2)+numdiv(n1^2))/2 -1, (numdiv((n/2)^2)+numdiv(n1^2))/2 -1);}
lista(nn) = {last = -1; for (n=1, nn, if ((new = nbpt(n)) > last, print1(n, ", "); last = new;););}
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.
Original entry on oeis.org
2, 14, 68, 203, 476, 1421, 3293, 7910, 20060, 39509, 89324, 206711, 442907, 803924, 1722464, 3198608, 6820523, 13434254, 27901259, 50222267
Offset: 1
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.
-
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)
Showing 1-2 of 2 results.
Comments