cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Previous Showing 21-23 of 23 results.

A374846 Numbers appearing exactly once in a Pythagorean triple.

Original entry on oeis.org

3, 4, 6, 7, 11, 14, 19, 22, 23, 31, 38, 43, 46, 47, 59, 62, 67, 71, 79, 83, 86, 94, 103, 107, 118, 127, 131, 134, 139, 142, 151, 158, 163, 166, 167, 179, 191, 199, 206, 211, 214, 223, 227, 239, 251, 254, 262, 263, 271, 278, 283, 302, 307, 311, 326, 331, 334, 347, 358, 359, 367, 379, 382, 383, 398
Offset: 1

Views

Author

Manfred Boergens, Jul 22 2024

Keywords

Comments

Positions of the ones in A046081.
With the exception a(2) = 4, the terms are given by A374845, thus providing a simple formula for the sequence.

Crossrefs

Programs

  • Mathematica
    t={}; Do[If[(PrimeQ[n] && Mod[n, 4] == 3) || (PrimeQ[n/2] && Mod [n/2, 4] == 3), t = Join[t, {n}]], {n, 445}]; t = Insert[t, 4, 2]
    (* Positions of the ones in  A046081; based on program by Jean-François Alcover *)
    a[1] = 0; a[n_] := Module[{f}, f = Select[FactorInteger[n], Mod[#[[1]], 4] == 1 &][[All, 2]]; (DivisorSigma[0, If[OddQ[n], n, n/2]^2] - 1)/2 + (Times @@ (2*f + 1) - 1)/2]; arr = Array[a, 445]; fl = Flatten[Position[arr, 1]]
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A374846_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:n==4 or (isprime(n) and n&3==3) or (isprime(n>>1) and n&7==6), count(max(startvalue,1)))
    A374846_list = list(islice(A374846_gen(),20)) # Chai Wah Wu, Jul 31 2024

Formula

p or 2p with p prime and p = 3 mod 4, with 4 added to the sequence, in ascending order.

A104461 Number of instances of nonprimes m in Pythagorean triples x,y,z such that x^2 + y^2 = z^2. Except for 1, the number of instances of composite numbers m in Pythagorean triples.

Original entry on oeis.org

0, 1, 1, 2, 2, 2, 4, 1, 5, 3, 2, 5, 4, 1, 7, 4, 2, 3, 4, 5, 4, 4, 2, 5, 7, 1, 5, 8, 4, 4, 8, 1, 10, 2, 4, 5, 5, 3, 5, 7, 4, 2, 14, 1, 7, 5, 8, 4, 5, 4, 5, 12, 2, 9, 4, 4, 5, 11, 4, 2, 13, 8, 1, 5, 7, 8, 5, 4, 4, 1, 5, 13, 2, 7, 9, 5, 8, 14, 2, 10, 5, 5, 10, 4, 5, 5, 8, 1, 5, 23, 2, 2, 5, 4, 6, 7, 6, 4, 8, 13
Offset: 1

Views

Author

Cino Hilliard, Apr 18 2005

Keywords

Comments

The PARI script is direct and very fast for m = x,y values but slows in the trial routine for m = z. We save some time for m even allowing the testing of only even values of y.

Examples

			For m=30 there are 5 Pythagorean triples that have a 30:
  30, 224, 226
  30,  72,  78
  30,  40,  50
  30,  16,  34
  18,  24,  30
		

Crossrefs

Programs

  • PARI
    \\ instances of m in Pythagorean triples using a direct method for x,y
    pythm3(m) = { local(m2,ln,j,j2=0,d,d2,q2,q,a,b,x,x1,x2,xx,y,y2,z,c,c2,r,f,str,stp); d=divisors(m^2); /* get the divisors of m^2 */ ln=length(d)-1; d2=q2=vector(ln); m2=m^2; if(m%2,r=1,r=0); for(j=1,ln, /* save only the both even r=0, both odd r=1 */ if(d[j]%2==r, if(m2/d[j]%2==r, j2++; d2[j2]=d[j]; q2[j2]=m2/d[j]; /* save m/factor to solve (z-y)(z+y) = m^2 */ ) ) ); x2=y2 = vector(20); for(j=1,j2, z=(d2[j] + q2[j])/2; y= z - d2[j]; if(y>0, c++; ) ); if(m%2==0,start=2;step=2,start=1;step=1); forstep(y=start,m-1,step, /* esolve when z is m */ x1 = (m2-y^2); if(issquare(x1), c2++; x2[c2]=floor(sqrt(x1)); /* save to later mask dupes */ y2[c2]=y; ) ); for(x=1,c2, /* mask the dupes routine */ for(y=x,c2, if(x2[x]==y2[y], ) ) ); return(c+c2/2) /* print total */}
    for(k=1,400,if(isprime(k)==0,print1(pythm3(k)", ")))

Formula

Consider Pythagorean triples x^2 + y^2 = z^2. We seek to find the total number of instances of an integer m being x or y or z. The solution for x or y is straightforward by considering appropriate lesser and greater pairwise factors, L, G of m^2 in z^2 - y^2 = (z-y)(z+y) = m^2. Then solve for z and y with the relations, z-y = L z+y = G 2z = L+G, z = (L+G)/2 where L and G are both even if m is even or both odd if m is odd. The number of L factors < m is the number of instances of x or y. The count of instances z=m is solved by trial on x^2 = m^2 - y^2.

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

Views

Author

Zhining Yang, Jun 26 2022

Keywords

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.
		

Crossrefs

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)
Previous Showing 21-23 of 23 results.