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 11-17 of 17 results.

A232175 Least positive k such that n^3 + k^2 is a square, or 0 if there is no such k.

Original entry on oeis.org

0, 1, 3, 6, 10, 3, 21, 8, 36, 15, 55, 6, 78, 35, 15, 48, 136, 27, 171, 10, 42, 99, 253, 10, 300, 143, 81, 42, 406, 15, 465, 64, 88, 255, 35, 63, 666, 323, 91, 3, 820, 21, 903, 55, 66, 483, 1081, 48, 1176, 125, 85, 39, 1378, 81, 165, 28, 76, 783, 1711, 15, 1830, 899, 63
Offset: 1

Views

Author

Alex Ratushnyak, Nov 19 2013

Keywords

Comments

Numbers n such that a(n) = n*(n-1)/2 appear to be A000430.
n = 1 is the only number for which a(n) = 0. - T. D. Noe, Nov 21 2013

Crossrefs

Programs

  • Mathematica
    Join[{0}, Table[k = 1; While[! IntegerQ[Sqrt[n^3 + k^2]], k++]; k, {n, 2, 100}]] (* T. D. Noe, Nov 21 2013 *)
  • PARI
    a(n) = {k = 1; while (!issquare(n^3+k^2), k++); k;} \\ Michel Marcus, Nov 20 2013
  • Python
    import math
    for n in range(77):
       n3 = n*n*n
       y=1
       for k in range(1, 10000001):
         s = n3 + k*k
         r = int(math.sqrt(s))
         if r*r == s:
           print(k, end=', ')
           y=0
           break
       if y: print(end='-, ')
    
  • Python
    from _future_ import division
    from sympy import divisors
    def A232175(n):
        n3 = n**3
        ds = divisors(n3)
        for i in range(len(ds)//2-1,-1,-1):
            x = ds[i]
            y = n3//x
            a, b = divmod(y-x,2)
            if not b:
                return a
        return 0 # Chai Wah Wu, Sep 12 2017
    

A300728 a(n) is the smallest positive number k such that k^2 + k*n + n^2 is a perfect square, or 0 if no such k exists.

Original entry on oeis.org

1, 0, 0, 5, 0, 3, 10, 8, 7, 15, 6, 24, 20, 35, 16, 9, 5, 63, 30, 80, 12, 24, 48, 120, 11, 15, 70, 45, 32, 195, 18, 224, 10, 7, 126, 13, 60, 323, 160, 16, 24, 399, 48, 440, 96, 27, 240, 528, 15, 56, 30, 40, 140, 675, 90, 33, 9, 55, 390, 840, 36, 899, 448, 17, 20, 39, 14, 1088, 252, 91, 26, 1224, 33, 1295, 646, 45
Offset: 0

Views

Author

Altug Alkan, Mar 11 2018

Keywords

Comments

A positive a(n) cannot be 1 or a multiple of n for n > 0 since there is no square in A002061 except 1. Also it is easy to show that a(n) cannot be 2 or 4 since a(2) = a(4) = 0.
From Robert Israel, Mar 12 2018: (Start)
If n >= 5 is odd, a(n) <= n^2/4 - n/2 - 3/4, with a(n) = n^2/4 - n/2 - 3/4 if n is a prime >= 5.
If n >= 10 and n == 2 (mod 4), a(n) <= n^2/8 - n/2 - 3/2, with equality if n/2 is a prime >= 5.
If n >= 16 and n == 0 (mod 4), 1 < a(n) <= n^2/16 - n/2 - 3, with equality if n/4 is 4 or a prime >= 5. (End)

Examples

			a(2) = 0 because k^2 + 2*k + 4 = (k + 1)^2 + 3 cannot be a square for k > 0.
a(4) = 0 because k^2 + 4*k + 16 = (k + 2)^2 + 12 cannot be a square for k > 0.
a(5) = 3 because 3^2 + 3*5 + 5^2 = 7^2 and 3 is the least positive number with this property.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k;
    for k from 1 do if issqr(k^2 + k*n + n^2) then return k fi od
    end proc:
    f(1):= 0: f(2):= 0: f(4):= 0:
    map(f, [$0..200]); # Robert Israel, Mar 12 2018
  • Mathematica
    f[n_] := Module[{k},
    For[k = 1, True, k++, If[IntegerQ[Sqrt[k^2 + k*n + n^2]], Return[k]]]];
    f[1] = 0; f[2] = 0; f[4] = 0;
    Map[f, Range[0, 200]] (* Jean-François Alcover, Nov 11 2023, after Robert Israel *)
  • Python
    from sympy.abc import x, y
    from sympy.solvers.diophantine.diophantine import diop_quadratic
    def A300728(n): return min((d[0] for d in diop_quadratic(x*(x+n)+n**2-y**2) if d[0]>0), default=0) if n else 1 # Chai Wah Wu, Nov 11 2023

A056138 Number of ways in which n can be the shorter leg (shortest side) of an integer-sided right triangle.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 3, 2, 1, 2, 1, 3, 3, 1, 1, 4, 2, 1, 3, 3, 1, 3, 1, 3, 4, 1, 3, 5, 1, 1, 4, 5, 1, 3, 1, 3, 5, 1, 1, 7, 2, 2, 4, 3, 1, 3, 3, 5, 4, 1, 1, 9, 1, 1, 5, 4, 4, 4, 1, 3, 4, 3, 1
Offset: 1

Views

Author

Henry Bottomley, Jun 15 2000

Keywords

Crossrefs

Programs

  • PARI
    a(n)=my(b);sum(c=n+2,n^2\2+1,issquare(c^2-n^2,&b) && nCharles R Greathouse IV, Jul 07 2013

Formula

a(n) = A046079(n) - A056137(n) = A046081(n) - A046080(n) - A056137(n).

A238376 Smallest other side of an Heronian triangle with a side of length n.

Original entry on oeis.org

4, 3, 3, 5, 15, 5, 10, 6, 13, 5, 4, 13, 4, 10, 8, 15, 20, 7, 10, 26, 123, 7, 3, 3, 29, 15, 5, 5, 68, 20, 25, 15, 8, 15, 12, 25, 10, 9, 9, 20, 61, 15, 12, 75, 250, 14, 105, 6, 4, 5, 4, 45, 12, 25, 60, 10, 68, 10, 11, 39, 16, 40, 7, 35, 85, 7, 29, 9, 447, 21, 9
Offset: 3

Views

Author

Giovanni Resta, Feb 25 2014

Keywords

Examples

			a(8) = 5 because (8,5,5) is Heronian triangle, and there are no such triangles with one side equal to 8 and another equal to 1, 2, 3 or 4.
		

Crossrefs

Cf. A055527.

Programs

  • Mathematica
    area[a_, b_, c_] := Block[{p=(a+b+c)/2}, Sqrt[p*(p-a)*(p-b)*(p-c)]]; a[n_] := Catch@ Block[{b = 0, c}, While[True, b++; Do[If[ IntegerQ[area[n, b, c]], Throw@b], {c, Max[Abs[n-b] + 1, b], n+b-1}]]] /; n > 2; a/@ Range[3,50]

A239975 Least k>0 such that n^2 + (n+k)^2 is a square, or -1 if no such k exists.

Original entry on oeis.org

7, 2, 17, 7, 3, 14, 49, 4, 71, 34, 5, 14, 127, 6, 161, 1, 7, 98, 241, 8, 35, 142, 9, 17, 391, 10, 449, 28, 11, 254, 49, 12, 647, 322, 13, 2, 799, 14, 881, 73, 15, 482, 1057, 7, 119, 70, 17, 113, 1351, 18, 77, 34, 19, 782, 1681, 3, 1799, 898, 21, 56, 7, 22, 2177, 217, 23
Offset: 5

Views

Author

Alex Ratushnyak, Mar 30 2014

Keywords

Comments

a(3*n) <= n because with k=n: (3*n)^2 + (4*n)^2 = (5*n)^2.

Examples

			a(6) = 2 because 6^2 + (6+2)^2 = 100 is a square.
a(20) = 1 because 20^2 + 21^2 = 841 = 29^2.
		

Crossrefs

Cf. A000290, A055527 (least k>0 such that n^2 + k^2 is a square).

Programs

  • PARI
    s=[]; for(n=5, 100, k=1; while(!issquare(n^2+(n+k)^2), k++); s=concat(s, k)); s \\ Colin Barker, Mar 31 2014
    
  • Python
    from sympy.ntheory.primetest import is_square
    def a(n):
        k = 1
        while not is_square(n**2 + (n+k)**2): k += 1
        return k
    print([a(n) for n in range(5, 70)]) # Michael S. Branicky, Jul 02 2021

A370574 a(n) is the least k > 0 such that n^2 XOR k^2 is a positive square number (where XOR denotes the bitwise XOR operator), or -1 if no such k exists.

Original entry on oeis.org

-1, -1, 4, 3, 3, 8, 24, 6, 23, 6, 44, 16, 43, 48, 36, 12, 111, 46, 180, 12, 72, 88, 9, 7, 7, 86, 20, 59, 20, 72, 56, 24, 479, 222, 20, 15, 20, 360, 15, 24, 183, 144, 13, 11, 11, 18, 943, 14, 1103, 14, 747, 172, 405, 40, 159, 31, 492, 40, 28, 144, 28, 112, 31, 48, 660
Offset: 1

Views

Author

Rémy Sigrist, Feb 22 2024

Keywords

Comments

This sequence has similarities with A055527; here we look for triples (n, k, m) of positive integers such that n^2 XOR k^2 = m^2, there for triples such that n^2 + k^2 = m^2.
Conjecture: a(n) > 0 for any n > 2.

Examples

			For n = 6: we have:
  k   6^2 XOR k^2  Positive square?
  --  -----------  ----------------
   1           37  No
   2           32  No
   3           45  No
   4           52  No
   5           61  No
   6            0  No
   7           21  No
   8          100  Yes
So a(6) = 8.
		

Crossrefs

Cf. A055527.

Programs

  • Maple
    f:= proc(n) local k;
      for k from 1 by 1 do if k <> n and issqr(MmaTranslator[Mma]:-BitXor(n^2, k^2)) then return k fi od
    end proc: f(1):= -1: f(2):= -1:
    map(f, [$1..100]); # Robert Israel, Mar 01 2024
  • Mathematica
    A370574[n_] := If[n <= 2, -1, Block[{k = 0}, While[++k == n || !IntegerQ[ Sqrt[BitXor[n^2, k^2]]]]; k]]; Array[A370574, 100] (* Paolo Xausa, Mar 01 2024 *)
  • PARI
    a(n) = { if (n <= 2, return (-1), for (k = 1, oo, if (k!=n &&  issquare( bitxor(n^2, k^2)), return (k)););); }
    
  • Python
    from sympy import integer_nthroot
    def A370574(n):
        if n <= 2: return -1
        k, n_2 = 1, n**2
        while True:
            if (integer_nthroot(n_2 ^ k**2, 2))[1] and k != n: return k
            k += 1 # Karl-Heinz Hofmann, Mar 03 2024

A066662 Shortest leg of a Pythagorean triangle with a hypotenuse of length 5n.

Original entry on oeis.org

3, 6, 9, 12, 7, 18, 21, 24, 27, 14, 33, 36, 16, 42, 21, 48, 13, 54, 57, 28, 63, 66, 69, 72, 35, 32, 81, 84, 17, 42, 93, 96, 99, 26, 49, 108, 57, 114, 48, 56, 45, 126, 129, 132, 63, 138, 141, 144, 147, 70, 39, 64, 23, 162, 77, 168, 171, 34, 177, 84, 55, 186, 189, 192
Offset: 1

Views

Author

Henry Bottomley, Jan 14 2002

Keywords

Comments

a(n) has values in the range from sqrt(10n-1) to 3n (or, slightly weaker but prettier, in the range from 3*sqrt(n) to 3n).

Examples

			a(1)=3 because 3^2+4^2=(5*1)^2; a(2)=6 because 6^2+8^2=(5+2)^2; a(5)=7 since 7^2+24^2=(5*5)^2.
		

Crossrefs

Extensions

Offset corrected by Sean A. Irvine, Nov 01 2023
Previous Showing 11-17 of 17 results.