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.

A092487 a(n) = least k such that {n+1, n+2, n+3, ... n+k} has a subset the product of whose members with n is a square.

Original entry on oeis.org

0, 4, 5, 0, 5, 6, 7, 7, 0, 8, 11, 8, 13, 7, 9, 0, 17, 9, 19, 10, 7, 11, 23, 8, 0, 13, 8, 12, 29, 12, 31, 13, 11, 17, 13, 0, 37, 19, 13, 10, 41, 14, 43, 11, 15, 23, 47, 6, 0, 13, 17, 13, 53, 16, 11, 16, 19, 29, 59, 15, 61, 31, 14, 0, 13, 14, 67, 17
Offset: 1

Views

Author

Don Reble, Apr 03 2004

Keywords

Comments

For n>1, n + a(n) is composite and n + a(n) is square if and only if n is square. - David A. Corneth, Oct 22 2016

Examples

			a(48)=6 because 48*(48+2)*(48+6) is a square, but you can't square 48 with numbers from (48+1) to (48+5).
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, B30.

Crossrefs

Programs

  • Mathematica
    Table[k = 0; Which[IntegerQ@ Sqrt@ n, k, And[PrimeQ@ n, n > 3], k = n, True, While[Length@ Select[n Map[Times @@ # &, n + Rest@ Subsets@ Range@ k], IntegerQ@ Sqrt@ # &] == 0, k++]]; k, {n, 40}] (* Michael De Vlieger, Oct 26 2016 *)
    Table[k = 0; Which[IntegerQ@Sqrt@n, k, First@Last@FactorInteger@n > Sqrt[2 n] + 1, k = First@Last@FactorInteger@n, True, While[Length@Select[n Map[Times @@ # &, n + Rest@Subsets@Range@k], IntegerQ@Sqrt@# &] == 0, k++]]; k, {n, 100}] (* Joshua Stucky, Dec 05 2022 *)
  • PARI
    a(n) = {if(issquare(n),return(0)); if(isprime(n),if(n>3, return(n), return(n+2) )); my(l = List([n,n+1]), m=2); while(1, for(i=1, #l-2, forvec(v = vector(i, j, [2,#l-1]), if(issquare(l[1] * l[#l] * prod(k=1, #v, l[v[k]])), return(l[#l] - n)), 2)); listput(l,n+m);m++)} \\ David A. Corneth, Oct 22 2016

Formula

a(n) = A006255(n) - n. - Peter Kagey, Oct 22 2016
a(n^2) = 0, a(p) = p for prime p > 3. - David A. Corneth, Oct 22 2016