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.

A308834 a(n) is the smallest error in trying to solve n^4 = x^4 + y^4. That is, for each n from 2 on, find positive integers x and y, x <= y < n such that |n^4 - x^4 - y^4| is minimal and let a(n) = n^4 - x^4 - y^4.

Original entry on oeis.org

14, 49, 94, 113, 46, -191, 399, 64, -657, 545, -466, -721, -145, 1328, 270, -2751, 719, -751, 1118, -1376, -1041, 1839, 1310, 1663, 815, 5184, -306, 9104, 863, 1455, 4320, 7024, -5105, 4289, 11504, 64, -12016, 2816, 10799, -11200, 6094, -2671, -226, 20753
Offset: 2

Views

Author

David S. Newman, Jun 27 2019

Keywords

Comments

This sequence was suggested to me by Moshe Shmuel Newman.
This is A135998 with the exponent 4 replacing 3.
From M. F. Hasler, Feb 03 2024: (Start)
Can it happen that (x,y) and (x',y') yield the same minimal absolute difference, but with opposite signs? If so, how is a(n) defined in this case?
Without the condition y < n, the trivial "solution" (x, y) = (1, n) would always yield a(n) = -1. With the condition, there is no admissible pair (x,y) for n = 1, whence a(1) is undefined. (End)

Examples

			Here are the calculations for the first few values.
For 2, the only possible values for x and y are 1,1, so we have
a(2) = 2^4 - 1^4 - 1^4 = 16 - 2 = 14.
For 3, y can be 1 or 2. if y is 1, x is 1 as well, and if y=2, then x can be 1 or 2.
3^4 - 1^4 - 1^4 = 79
3^4 - 1^4 - 2^4 = 64
3^4 - 2^4 - 2^4 = 49.
The smallest absolute value is in the last case, so a(3) = 49.
		

Crossrefs

Cf. A135998 (equivalent for 3rd powers).

Programs

  • Mathematica
    nend = 100;For[n = 2, n <= nend, n++, a[n] = 0];For[n = 2, n <= nend, n++, min = n^4; For[y = 1, y <= n - 1, y++,  For [x = y, x <= n - 1, x++,   changed = False;   sol = n^4 - x^4 - y^4;   If[(sol < min) && (sol > 0), min = sol; changed = True];   If[(Abs[sol] < min) && (sol < 0), min = -sol; changed = True];   If[changed, a[n] = sol]]]]; Print[t = Table[a[i], {i, 2, nend}]] (* or *)
    a[n_] := SortBy[n^4 - Flatten[Table[x^4 + y^4, {x, n-1}, {y, x}]], Abs][[1]]; Array[a, 99, 2] (* Giovanni Resta, Jul 05 2019 *)
  • PARI
    A308834(n, p=4) = { my(np=n^p, m=np); for(y=max(sqrtnint(np\2, p), 1), n-1, my(x = sqrtnint(np - y^p, p), dy = np-y^p, d = if(dy-x^p > (x+1)^p-dy && x < n-1, dy-(x+1)^p, dy-x^p)); abs(d) < abs(m) && abs(m=d) < 2 && break); m} \\ M. F. Hasler, Feb 03 2024

A369855 a(n) is the smallest error in trying to solve n^5 = x^5 + y^5: for each n from 2 on, find positive integers x and y, x <= y < n such that |n^5 - x^5 - y^5| is minimal and let a(n) = n^5 - x^5 - y^5. In case of a tie, choose the solution with smallest y.

Original entry on oeis.org

30, 179, 538, 1077, 1526, 1255, -846, -6487, 8183, 2002, -12219, 22461, 5480, 16789, -27072, -12, -68113, 7666, -35474, 124726, 20955, 36343, 106424, -86567, -165349, -8568, 175360, 100781, 185468, -68663, -228351, 427329, -384, -407276, -18323, -388286, 125586, 369093, 294425, -892706
Offset: 2

Views

Author

M. F. Hasler, Feb 03 2024

Keywords

Comments

We must impose y < n to exclude the trivial solution x = 1, y = n, a(n) = -1.
There is no admissible pair (x, y) for n = 1, whence a(1) is undefined.
What is the first n for which we have two solutions (x, y) that yield the same minimal absolute difference but opposite signs for n^5 - x^5 - y^5?

Examples

			For n = 2, the only admissible pair is (x, y) = (1, 1), which yields a(2) = n^5 - x^5 - y^5 = 30.
Similarly, for n = 3, 4, ..., 9 the minimum is reached for x = y = n - 1, which yields a(n) = n^5 - 2*(n-1)^5 = 179, 538, 1077, 1526, 1255, -846 and -6487, respectively.
For n = 10, the minimum is reached for x = 8, y = 9, which yields a(10) = 10^5 - 8^5 - 9^5 = 8183, smaller in absolute value than 10^5 - 2*9^5 = -18098.
		

Crossrefs

Cf. A135998 (equivalent for 3rd powers), A308834 (4th powers).

Programs

  • PARI
    A369855(n, p=5) = { my(np=n^p, m=np); for(y=max(sqrtnint(np\2, p), 1), n-1, my(x = sqrtnint(np - y^p, p), dy = np-y^p, d = if(dy-x^p > (x+1)^p-dy && x < n-1, dy-(x+1)^p, dy-x^p)); abs(d) < abs(m) && abs(m=d) < 2 && break); m} \\ M. F. Hasler, Feb 03 2024

A369862 a(n) is the smallest error in trying to solve n^2 = x^2 + y^2: given n >= 2, find positive integers x <= y < n such that |n^2 - x^2 - y^2| is minimal and let a(n) = n^2 - x^2 - y^2. In case of a tie, choose the value with the smallest y.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Feb 03 2024

Keywords

Comments

We impose y < n to exclude the trivial solution x = 1, y = n, a(n) = -1.
Then there is no admissible pair (x, y) for n = 1, whence a(1) is undefined.

Examples

			For n = 2, the largest possible x = y = 1 give the minimal n^2 - x^2 - y^2 = 4 - 2 * 1^2 = 2 = a(2).
Similarly, for n = 3 and n = 4, the largest possible x = y = n - 1 give the minimal a(n) = n^2 - 2*(n-1)^2, a(3) = 9 - 2*4 = 1 and a(4) = 16 - 2*9 = -2.
For n = 5 which is a hypotenuse number (<=> has a prime factor of the form 4k+1), we have a(5) = 5^2 - 3^2 - 4^2 = 0.
		

Crossrefs

Cf. A135998 (equivalent for 3rd powers), A308834 (4th powers), A369855 (5th powers).
Cf. A009003.

Programs

  • PARI
    A369862(n, p=2) = { my(np=n^p, m=np); for(y=max(sqrtnint(np\2, p), 1), n-1, my(x = sqrtnint(np - y^p, p), dy = np-y^p, d = if(dy-x^p > (x+1)^p-dy && x < n-1, dy-(x+1)^p, dy-x^p)); abs(d) < abs(m) && !(m=d) && break); m} \\ Not optimized: one could immediately return 0 when a solution of x^2 + y^2 = n^2 is known to exist, and similarly with n^2 +- k for small k.

Formula

a(n) = 0 for Hypotenuse numbers, n in A009003.
Showing 1-3 of 3 results.