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

A055081 Number of positive integers whose harmonic mean with n is a positive integer.

Original entry on oeis.org

1, 2, 3, 3, 3, 7, 3, 4, 5, 6, 3, 10, 3, 6, 10, 5, 3, 11, 3, 10, 9, 6, 3, 13, 5, 6, 7, 10, 3, 20, 3, 6, 9, 6, 10, 16, 3, 6, 9, 13, 3, 20, 3, 9, 17, 6, 3, 16, 5, 10, 9, 9, 3, 15, 9, 13, 9, 6, 3, 30, 3, 6, 16, 7, 9, 20, 3, 9, 9, 19, 3, 22, 3, 6, 16, 9, 10, 19, 3, 16, 9, 6, 3, 30, 9, 6, 9, 13, 3, 33
Offset: 1

Views

Author

Henry Bottomley, Jun 13 2000

Keywords

Comments

Also the number of factors of 2n^2 which are less than 2n, since the harmonic mean of n and 2n^2/k-n is 2n-k and these are all positive integers iff k<2n is a factor of 2n^2. So a(n)=3 iff n=4 or n is an odd prime.
For any n>2, there are three distinct trivial Diophantine solutions of H(n,x)=y, H being the harmonic mean: [x=n,y=n],[x=n(n-1),y=2(n-1)],[x=n(2n-1),y=2n-1]. Existence of any other solution proves that n is not a prime. - Stanislav Sykora, Feb 03 2016
a(n)=4 only for n=8. a(n)=5 iff n is 16 or the square of an odd prime. - Robert Israel, Feb 07 2016

Examples

			a(6)=7 since the pairwise harmonic means of 6 with 2, 3, 6, 12, 18, 30 and 66 are 3, 4, 6, 8, 9, 10 and 11 respectively.
		

Crossrefs

The smallest and largest positive integers whose harmonic means with n are positive integers are A053626 and A000384 with harmonic means of A053627 and A004273.

Programs

  • Maple
    seq(nops(select(`<`,numtheory:-divisors(2*n^2),2*n)),n=1..100); # Robert Israel, Feb 07 2016
  • Mathematica
    Count[Divisors[2 #^2], x_ /; x < 2 #] & /@ Range[90] (* Ivan Neretin, May 04 2015 *)
  • PARI
    a(n) = {my(c=0); for(y=1, 2*n-1, if((y*n)%(2*n-y)==0, c++)); return(c);} \\ Stanislav Sykora, Feb 03 2016

Formula

a(n) >= min(n,3). - Stanislav Sykora, Feb 03 2016
a(2^n) = n+1, a(p^n) = 2n+1 if p>=3 is prime. - Benoit Cloitre, Nov 26 2023

A038387 a(n) is the smallest number such that the arithmetic mean (A) and geometric mean (G) of n and a(n) are both integers.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 2, 1, 10, 11, 12, 13, 14, 15, 4, 17, 2, 19, 20, 21, 22, 23, 6, 1, 26, 3, 28, 29, 30, 31, 2, 33, 34, 35, 4, 37, 38, 39, 10, 41, 42, 43, 44, 5, 46, 47, 12, 1, 2, 51, 52, 53, 6, 55, 14, 57, 58, 59, 60, 61, 62, 7, 4, 65, 66, 67, 68, 69, 70, 71, 2, 73, 74, 3, 76, 77, 78
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Table[k = 1; While[Nand @@ IntegerQ /@ {(n + k)/2, Sqrt[n*k]}, k++]; k, {n, 78}] (* Jayanta Basu, Jul 14 2013 *)
    f[p_, e_] := If[OddQ[e], p, If[p == 2, 4, 1]]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 09 2020 *)
  • PARI
    a(n)={for(k=1, n, if((n+k)%2==0 && issquare(n*k), return(k)))} \\ Andrew Howroyd, Feb 12 2018
    
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i,2]%2, f[i,1], if(f[i,1]==2, 4, 1)));} \\ Amiram Eldar, Oct 27 2022

Formula

If n is odd with prime factorization p1^j1*p2^j2*...pk^jk then f(n)=p1^(j1 mod 2)*p2^(j2 mod 2)*... If n is even then f(n)=2^(2-(j1 mod 2))*p2^(j2 mod 2)*... f(n)=n whenever n is squarefree or n/2 is squarefree. (Christian G. Bower)
Multiplicative with a(p^e) = p if e is odd, 4 if p=2 and e is even, 1 if p>2 and e is even. - Vladeta Jovovic, May 15 2003
Sum_{k=1..n} a(k) ~ c * n^2, where c = 3*Pi^2/80 = 0.3701101... . - Amiram Eldar, Oct 27 2022

Extensions

More terms from Vladeta Jovovic, May 15 2003

A038388 Let f(n) be the smallest number such that the arithmetic mean (A) and geometric mean (G) of n and f(n) are both integers; sequence gives G values.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 4, 3, 10, 11, 12, 13, 14, 15, 8, 17, 6, 19, 20, 21, 22, 23, 12, 5, 26, 9, 28, 29, 30, 31, 8, 33, 34, 35, 12, 37, 38, 39, 20, 41, 42, 43, 44, 15, 46, 47, 24, 7, 10, 51, 52, 53, 18, 55, 28, 57, 58, 59, 60, 61, 62, 21, 16, 65, 66, 67, 68, 69, 70, 71, 12, 73, 74, 15
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Table[k = 1; While[Nand @@ IntegerQ /@ {(n + k)/2, g = Sqrt[n*k]}, k++]; g, {n, 75}] (* Jayanta Basu, Jul 14 2013 *)
    f[p_, e_] := If[OddQ[e], p^((e + 1)/2), If[p == 2, 2^(e/2 + 1), p^(e/2)]]; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 09 2020*)
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i,2]%2, f[i,1]^((f[i,2]+1)/2), if(f[i,1]==2, 2^(f[i,2]/2+1), f[i,1]^(f[i,2]/2))));} \\ Amiram Eldar, Oct 27 2022

Formula

Multiplicative with a(p^e) = p^((e+1)/2) if e is odd, 2^(e/2+1) if p=2 and e is even, p^(e/2) if p>2 and e is even. - Vladeta Jovovic, May 15 2003
Sum_{k=1..n} a(k) ~ c * n^2, where c = (13/24)*zeta(3)/zeta(2) = 0.395829... . - Amiram Eldar, Oct 27 2022

Extensions

More terms from Vladeta Jovovic, May 15 2003

A301941 a(n) is the smallest positive integer k such that n + k divides n^2 + k, or 0 if no such k exists.

Original entry on oeis.org

1, 1, 0, 3, 2, 5, 4, 7, 6, 3, 5, 11, 10, 13, 12, 6, 4, 17, 16, 19, 18, 7, 11, 23, 22, 5, 24, 12, 8, 29, 28, 31, 30, 11, 17, 35, 6, 37, 36, 18, 12, 41, 40, 43, 42, 10, 23, 47, 46, 7, 20, 24, 16, 53, 52, 11, 14, 19, 29, 59, 58, 61, 60, 30, 8, 15, 12, 67, 66, 23, 35, 71, 70, 73, 72, 36, 19, 56, 13, 79, 78, 9, 41, 83, 82, 17, 84
Offset: 0

Views

Author

Altug Alkan, Mar 29 2018

Keywords

Comments

If even n > 2, such positive k exists and a(n) <= n - 2 since n^2 + n - 2 = (n + 2)*(n - 1) is divisible by n + n - 2 = 2*(n - 1). Additionally, a(2) = 0 because such positive k does not exist. So a(n) <= n - 2 for even positive n.
1 <= a(n) <= n for odd n, in particular, a(p) = p if p is an odd prime and it is also possible that a(t) = t for some composite t. Composite numbers t such that a(t) = t are 35, 95, 119, 143, 203, 215, 247, 275, 299, 335, 395, 403, 437, ...
From Robert Israel, Mar 29 2018: (Start)
If n >= 1 is a square, then a(n) = sqrt(n).
If n is not a square but 8*n+1 is a square, then f(n) = (sqrt(8*n+1)+1)/2.
If n >= 3 and neither n nor 8*n+1 is a square, then a(n) > sqrt(3*n+1).
For n >= 3, n and a(n) are not coprime. (End)
From Bob Andriesse, Jan 02 2024: (Start)
Proof that a(n) = n, if n is an odd prime: Consider any odd n and choose k = n, then (n^2+k)/(n+k) becomes n*(n+1)/(2n), which is an integer. So a(n) = k <= n, for odd n. If n+k = z then k = z-n and n+k | n^2 + k is equivalent to z | n^2 + z-n or z | n^2 - n. So n+k | n*(n-1). If n is an odd prime and k < n, then n+k must divide n-1, which is impossible. Therefore k >= n. We already know that k <= n, so k = n if n is an odd prime p, or a(p) = p.
a(n) is also the smallest k > 0 such that n+k divides n*(k+1), k*(k+1), n*(n-1), k*(n-1) and k^2-n, or 0 if no such k exists. Example: 15+6 divides 15*(6+1), 6*(6+1), 15*(15-1), 6*(15-1) and 6^2-15. (End)

Examples

			a(2) = 0 because there is no positive k such that k + 2 divides k + 4.
a(15) = 6 because 15 + 6 = 3*7 divides 15^2 + 6 = 3*7*11 and 6 is the least positive integer with this property.
		

Crossrefs

Cf. A053626.

Programs

  • Maple
    f:= proc(n) local k;
      if issqr(n) then return sqrt(n) fi;
      for k from ceil(sqrt(2*n)) do if (n^2+k) mod (n+k) = 0 then return k fi od
    end proc:
    f(2):= 0: f(0):= 1:
    map(f, [$0..100]); # Robert Israel, Mar 29 2018
  • Mathematica
    a[n_] := If[n == 2, 0, If[PrimeQ[n], n, Module[{k = 1}, While[Mod[n^2+k, n+k] != 0, k++]; k]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 10 2023, from PARI code *)
  • PARI
    a(n) = {if(n==2, 0, if(isprime(n), n, my(k=1); while((n^2+k) % (n+k) != 0, k++); k; ))}

A302706 a(n) is the maximum remainder of x^2 + y^2 divided by x + y with 0 < x <= y <= n.

Original entry on oeis.org

0, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 16, 18, 18, 18, 26, 27, 28, 29, 30, 32, 32, 33, 34, 35, 40, 40, 40, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 72, 72, 72, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 98, 98, 98, 98, 98, 98, 99, 100, 104, 104, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132
Offset: 1

Views

Author

Altug Alkan and Andres Cicuttin, Apr 12 2018

Keywords

Comments

Values of a(n) such that a(n) is prime are 2, 3, 5, 11, 13, 29, 53, 59, 61, 83, 89, 127, 131, 137, 139, 173, ...
Conjecture: lim_{n->inf} a(n)/(2n) = 1, with both variables x and y taking values asymptotically close to n. - Andres Cicuttin, Oct 18 2018

Examples

			a(1) = 0 because x = y = 1 is only option.
a(13) = a(14) = a(15) = 18 because (7^2 + 13^2) mod (7 + 13) = 18 is the largest corresponding remainder for them.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Table[Table[Mod[x^2+y^2 ,x+y],{x,1,y}],{y,1,n}]//Flatten//Max;
    Table[a[n],{n,1,100}]
  • PARI
    a(n) = vecmax(vector(n, x, vecmax(vector(x, y, (x^2+y^2) % (x+y))))); \\ after Michel Marcus at A302245
Showing 1-5 of 5 results.