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.

Showing 1-3 of 3 results.

A024359 Number of primitive Pythagorean triangles with short leg n.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 1, 1, 2, 0, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 2, 2, 1, 0, 1, 1, 2, 0, 1, 3, 1, 0, 1, 1, 2, 0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1, 0, 1, 3, 2, 0, 2
Offset: 1

Views

Author

Keywords

Comments

Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence gives number of times A takes value n.
Number of times n occurs in A020884.
a(A139544(n)) = 0; a(A024352(n)) > 0. - Reinhard Zumkeller, Nov 09 2012

Crossrefs

Cf. A020884, A024352, A024360, A024361, A132404 (where records occur), A139544.

Programs

  • Haskell
    a024359_list = f 0 1 a020884_list where
       f c u vs'@(v:vs) | u == v = f (c + 1) u vs
                        | u /= v = c : f 0 (u + 1) vs'
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Mathematica
    solns[a_] := Module[{b, c, soln}, soln = Reduce[a^2 + b^2 == c^2 && a < b && c > 0 && GCD[a, b, c] == 1, {b, c}, Integers]; If[soln === False, 0, If[soln[[1, 1]] === b, 1, Length[soln]]]]; Table[solns[n], {n, 100}]
    (* Second program: *)
    a[n_] := Module[{s = 0, b, c, d, g}, Do[g = Quotient[n^2, d]; If[d <= g && Mod[d+g, 2] == 0, c = Quotient[d+g, 2]; b = g-c; If[n < b && GCD[b, c] == 1, s++]], {d, Divisors[n^2]}]; s]; Array[a, 100] (* Jean-François Alcover, Apr 27 2019, from PARI *)
  • PARI
    nppt(a) = {
      my(s=0, b, c, d, g);
      fordiv(a^2, d,
        g=a^2\d;
        if(d<=g && (d+g)%2==0,
          c=(d+g)\2; b=g-c;
          if(aColin Barker, Oct 25 2015

Formula

a(n) = A024361(n) - A024360(n). - Ray Chandler, Feb 03 2020

A307706 Number of unitary divisors of n that are smaller than sqrt((sqrt(2) - 1)*n).

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 3, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 3, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 1, 2, 2, 1, 3, 1, 2, 1, 1, 2, 3, 1, 2, 2, 3, 1, 1, 1, 2, 2, 2, 1, 3, 1, 2, 1, 2, 1, 3, 2, 2, 2, 1, 1, 3, 1, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 4, 1
Offset: 1

Author

Jianing Song, Apr 23 2019

Keywords

Comments

Related to A024359: (Start)
Note that all the primitive Pythagorean triangles are given by A = min{2*u*v, u^2 - v^2}, B = max{2*u*v, u^2 - v^2}, C = u^2 + v^2, where u, v are coprime positive integers, u > v and u - v is odd. As a result:
(a) if n is odd, then A024359(n) is the number of representations of n to the form n = u^2 - v^2, where u, v are coprime positive integers (note that this guarantees that u - v is odd), u > v and u^2 - v^2 < 2*u*v. Let s = u + v, t = u - v, then n = s*t, where s and t are unitary divisors of n, s > t and s*t < (s^2 - t^2)/2, so t is in the range (0, sqrt((sqrt(2) - 1)*n));
(b) if n is divisible by 4, then A024359(n) is the number of representations of n to the form n = 2*u*v, where u, v are coprime positive integers (note that this also guarantees that u - v is odd because n/2 is even), u > v and 2*u*v < u^2 - v^2. So u and v must be unitary divisors of n/2, and v is in the range (0, sqrt((sqrt(2) - 1)*(n/2))).
(c) if n == 2 (mod 4), then n/2 is odd, so n = 2*u*v implies that u and v are both odd, which is not acceptable, so A024359(n) = 0.
Similarly, let b(n) be the number of unitary divisors of n in the range (sqrt((sqrt(2) - 1)*n), sqrt(n)) (= A034444(n)/2 - a(n) for n > 1), then the number of times B takes value n is b(n) for odd n > 1, b(n/2) if n is divisible by 4 and 0 if n = 1 or n == 2 (mod 4). (End)
For k >= 2, the earliest occurrence of k is at n = A132404(k)/2 if A132404(k) is even (and thus being a multiple of 4). Conjecture: this is always the case.

Examples

			The unitary divisors of 210 that are smaller than sqrt((sqrt(2) - 1)*210) = 9.3265... are 1, 2, 3, 5, 6 and 7, so a(210) = 6. Correspondingly, A024359(420) = 6.
		

Crossrefs

Programs

  • PARI
    a(n) = my(i=0); for(k=1, sqrt((sqrt(2)-1)*n), if(!(n%k) && gcd(k,n/k)==1, i++)); i

Formula

A024359(n) = a(n) for odd n; A024359(n) = a(n/2) for n divisible by 4.

A379596 a(n) is the least positive integer k for which k^2 + (k + n)^2 is a square.

Original entry on oeis.org

3, 6, 9, 12, 15, 18, 5, 24, 27, 30, 33, 36, 39, 10, 45, 48, 7, 54, 57, 60, 15, 66, 12, 72, 75, 78, 81, 20, 87, 90, 9, 96, 99, 14, 25, 108, 111, 114, 117, 120, 36, 30, 129, 132, 135, 24, 16, 144, 11, 150, 21, 156, 159, 162, 165, 40, 171, 174, 177, 180, 183, 18, 45
Offset: 1

Author

Felix Huber, Feb 15 2025

Keywords

Comments

a(n) is also the smallest short leg of a Pythagorean triangle where the difference between the two legs is n.
A289398(n) is the least integer m > n for which (n^2 + m^2)/2 is a square. This is equivalent to the least positive integer k for which (n^2 + (n + 2*k)^2)/2 = k^2 + (n + k)^2 is a square. From m = n + 2*k follows a(n) = (A289398(n) - n)/2.

Examples

			a(1) = 3 because 3^2 + (3 + 1)^2 = 5^2 and there is no smaller positive integer k than 3 with that property.
a(28) = 20 because 20^2 + (20 + 28)^2 = 52^2 and there is no smaller positive integer k than 20 with that property.
		

Programs

  • Maple
    A379596:=proc(n)
        local k;
        for k do
            if issqr(k^2+(k+n)^2) then
                return k
            fi
        od
    end proc;
    seq(A379596(n),n=1..63);
  • Mathematica
    s={};Do[k=0;Until[IntegerQ[Sqrt[k^2+(k+n)^2]],k++];AppendTo[s,k],{n,63}];s (* James C. McMahon, Mar 02 2025 *)
  • PARI
    a(n) = my(k=1); while (!issquare(k^2 + (k + n)^2), k++); k; \\ Michel Marcus, Feb 15 2025
    
  • Python
    from itertools import count
    from sympy.ntheory.primetest import is_square
    def A379596(n): return next(k for k in count(1) if is_square(k**2+(k+n)**2)) # Chai Wah Wu, Mar 02 2025

Formula

a(n) = (A289398(n) - n)/2.
Showing 1-3 of 3 results.