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-2 of 2 results.

A302245 Maximum remainder of p*q divided by p+q with 0 < p <= q <= n.

Original entry on oeis.org

1, 2, 3, 5, 7, 8, 11, 11, 15, 15, 19, 19, 23, 23, 27, 27, 31, 31, 35, 35, 39, 39, 43, 43, 47, 47, 51, 51, 55, 55, 59, 59, 63, 63, 67, 67, 71, 71, 75, 75, 79, 79, 83, 83, 87, 87, 91, 91, 95, 95, 99, 99, 103, 103, 107, 107, 111, 111, 115, 115, 119, 119, 123, 123
Offset: 1

Views

Author

Andres Cicuttin, Apr 03 2018

Keywords

Examples

			For n=2 the three possible pairs of positive numbers are enumerated in the following table
(i,j) (i*j) (i+j) (i*j) mod (i+j)
(1,1)   1     2          1
(1,2)   2     3          2
(2,2)   4     4          0
The greatest remainder is 2 then a(2)=2, and similarly for n=3 the corresponding table is
(i,j) (i*j) (i+j) (i*j) mod (i+j)
(1,1)   1     2          1
(1,2)   2     3          2
(2,2)   4     4          0
(1,3)   3     4          3
(2,3)   6     5          1
(3,3)   9     6          3
The greatest remainder is 3, then a(3)=3.
		

Crossrefs

Programs

  • Maple
    1, 2, 3, 5, 7, 8, seq(2*(n-2)-(-1)^n, n=7..100); # Robert Israel, Apr 05 2018
  • Mathematica
    a[n_]:=Table[Table[Mod[i*j, i + j], {i, 1, j}], {j, 1, n}]//Flatten//Max;
    Table[a[n], {n, 1, 64}]
  • PARI
    a(n) = vecmax(vector(n, q, vecmax(vector(q, p, (p*q) % (p+q))))); \\ Michel Marcus, Apr 05 2018
    
  • PARI
    a(n) = if(n<7,(n+2)*(n+4)\9, 2*(n-2)-(-1)^n); \\ Altug Alkan, Apr 07 2018

Formula

Conjecture: a(n) = 2*(n - 2) - (-1)^n for n > 6.
From Altug Alkan and Robert Israel, Apr 05 2018: (Start)
Proof of conjecture:
For n >= 3 odd, we do have p=n-2, q=n, p*q = n^2-2*n = (n-3)/2 * (p+q) + 2*n-3, so a remainder of 2*n-3 is possible.
The only possible p <= q <= n with p+q-1 > 2*n-3 are p=n-1,q=n and p=n,q=n, neither of which can improve on this:
For p=q=n, p*q = (n-1)/2 * (p+q) + n with n <= 2*n-3.
For p=n-1, q=n, p*q = (n-1)/2 * (p+q) + (n-1)/2 with (n-1)/2 < n
For n >= 8 even, we have all the cases that worked for n-1, with maximum remainder 2*(n-1)-3 = 2*n-5, and additional possibilities q=n,p=n-3 to n, which don't improve on this:
For p=n-3, q=n, p*q = (n/2-1)*(p+q) + n/2-3 with n/2-3 < 2*n-5
For p=n-2, q=n, p*q = (n/2-1)*(p+q) + n-2 with n-2 < 2*n-5
For p=n-1, q=n, p*q = (n/2-1)*(p+q) + 3*n/2-1 with 3*n/2-1 < 2*n-5.
For p=n, q=n, p*q = (n/2)*(p+q) + 0.
(End)

A298364 Permutation of the natural numbers partitioned into quadruples [4k-2, 4k-1, 4k-3, 4k] for k > 0.

Original entry on oeis.org

2, 3, 1, 4, 6, 7, 5, 8, 10, 11, 9, 12, 14, 15, 13, 16, 18, 19, 17, 20, 22, 23, 21, 24, 26, 27, 25, 28, 30, 31, 29, 32, 34, 35, 33, 36, 38, 39, 37, 40, 42, 43, 41, 44, 46, 47, 45, 48, 50, 51, 49, 52, 54, 55, 53, 56, 58, 59, 57, 60, 62, 63, 61, 64, 66, 67, 65
Offset: 1

Views

Author

Guenther Schrack, Jan 18 2018

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1,2,3,4); swap the first and second elements, then swap the second and third elements; repeat for all quadruples.

Crossrefs

Inverse: A292576.
Sequence of fixed points: A008586(n) for n > 0.
First differences: (-1)^floor(n^2/4)*A068073(n-1) for n > 0.
Subsequences:
elements with odd index: A042963(A103889(n)) for n > 0.
elements with even index A014601(n) for n > 0.
odd elements: A166519(n-1) for n > 0.
indices of odd elements: A042964(n) for n > 0.
even elements: A005843(n) for n > 0.
indices of even elements: A042948(n) for n > 0.
Other similar permutations: A116966, A284307, A292576.

Programs

  • MATLAB
    a = [2 3 1 4];
    max = 10000;    % Generation of b-file.
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • Mathematica
    Nest[Append[#, #[[-4]] + 4] &, {2, 3, 1, 4}, 63] (* or *)
    Array[# + ((-1)^# + ((-1)^(# (# - 1)/2)) (1 - 2 (-1)^#))/2 &, 67] (* Michael De Vlieger, Jan 23 2018 *)
    LinearRecurrence[{1,0,0,1,-1},{2,3,1,4,6},70] (* Harvey P. Dale, Dec 12 2018 *)
  • PARI
    for(n=1, 100, print1(n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2, ", "))

Formula

O.g.f.: (3*x^3 - 2*x^2 + x + 2)/(x^5 - x^4 - x - 1).
a(1) = 2, a(2) = 3, a(3) = 1, a(4) = 4, a(n) = a(n-4) + 4 for n > 4.
a(n) = n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2.
a(n) = n + (cos(n*Pi) - cos(n*Pi/2) + 3*sin(n*Pi/2))/2.
a(n) = 2*floor((n+1)/2) - 4*floor((n+1)/4) + floor(n/2) + 2*floor(n/4).
a(n) = n + (-1)^floor((n-1)^2/4)*A140081(n) for n > 0.
a(n) = A056699(n+1) - 1, n > 0.
a(n+2) = A168269(n+1) - a(n), n > 0.
a(n+2) = a(n) + (-1)^floor((n+1)^2/4)*A132400(n+2) for n > 0.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
First differences: periodic, (1, -2, 3, 2) repeat.
Compositions:
a(n) = A080412(A116966(n-1)) for n > 0.
a(n) = A284307(A256008(n)) for n > 0.
a(A067060(n)) = A133256(n) for n > 0.
A116966(a(n+1)-1) = A092486(n) for n >= 0.
A056699(a(n)) = A256008(n) for n > 0.
Showing 1-2 of 2 results.