Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Dec 10 2022 10:48:17
%S 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,
%T 12,31,13,11,17,13,0,37,19,13,10,41,14,43,11,15,23,47,6,0,13,17,13,53,
%U 16,11,16,19,29,59,15,61,31,14,0,13,14,67,17
%N 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.
%C 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
%D R. K. Guy, Unsolved Problems in Number Theory, B30.
%H Peter Kagey, <a href="/A092487/b092487.txt">Table of n, a(n) for n = 1..10000</a>
%H H. B. Bui, K. Pratt, and A. Zaharescu, <a href="https://arxiv.org/abs/2211.12467">A problem of Erdos-Graham-Granville-Selfridge on integral points on hyperelliptic curves</a>, arXiv:2211.12467 [math.NT], 2022.
%H A. Granville and J. L. Selfridge, <a href="https://doi.org/10.37236/1549">Products of integers in an interval, modulo squares</a>, Electron. J. Combin. 8 (2001), no. 1.
%F a(n) = A006255(n) - n. - _Peter Kagey_, Oct 22 2016
%F a(n^2) = 0, a(p) = p for prime p > 3. - _David A. Corneth_, Oct 22 2016
%e 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).
%t 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 *)
%t 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_, December 5 2022 *)
%o (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
%Y Cf. A006255, A092488.
%K nonn,easy
%O 1,2
%A _Don Reble_, Apr 03 2004