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.

A289398 Least integer m > n such that (n^2 + m^2)/2 is a square.

This page as a plain text file.
%I A289398 #27 Mar 02 2025 10:03:41
%S A289398 7,14,21,28,35,42,17,56,63,70,77,84,91,34,105,112,31,126,133,140,51,
%T A289398 154,47,168,175,182,189,68,203,210,49,224,231,62,85,252,259,266,273,
%U A289398 280,113,102,301,308,315,94,79,336,71,350,93,364,371,378,385,136,399,406,413,420
%N A289398 Least integer m > n such that (n^2 + m^2)/2 is a square.
%C A289398 From first 100 terms, in 65 cases a(n) = 7*n. In general, a(n) <= 7*n.
%C A289398 From _Robert Israel_, Jul 07 2017: (Start)
%C A289398 For any p in A042999, a(n) == 0 (mod p) if and only if n == 0 (mod p), with a(p*k) = p*a(k).
%C A289398 Thus if n = m*r where all prime factors of m are in A042999, a(n) = m*a(r).
%C A289398 In particular, if all prime factors of n are in A042999, then a(n) = 7*n.
%C A289398 Conjecture: this is "if and only if".
%C A289398 (End)
%C A289398 Alternatively: A306236(n) is the smallest integer m > n with integer j > m that makes n^2, m^2 and j^2 an arithmetic progression. This is the sequence of j. - _Jinyuan Wang_, Feb 09 2019.
%H A289398 Robert Israel, <a href="/A289398/b289398.txt">Table of n, a(n) for n = 1..10000</a>
%e A289398 a(1)=7: (1^2 + 7^2)/2 = 5^2;
%e A289398 a(7)=17: (7^2 + 17^2)/2 = 5^2.
%p A289398 f:= proc(n) local m; for m from n+2 by 2 do if issqr((n^2+m^2)/2) then return m fi od end proc:
%p A289398 map(f, [$1..100]); # _Robert Israel_, Jul 07 2017
%t A289398 n=0;Table[n++;m=n+1;While[!IntegerQ[Sqrt[(n^2+m^2)/2]],m++];m,{100}]
%o A289398 (PARI) a(n) = my(m=n+1); while(!issquare((n^2+m^2)/2), m++); m; \\ _Michel Marcus_, Jul 07 2017
%o A289398 (Python)
%o A289398 from itertools import count
%o A289398 from sympy.ntheory.primetest import is_square
%o A289398 def A289398(n): return next(m for m in count(n+2,2) if is_square(n**2+m**2>>1)) # _Chai Wah Wu_, Mar 02 2025
%Y A289398 Cf. A042999, A075892, A306236.
%K A289398 nonn,look
%O A289398 1,1
%A A289398 _Zak Seidov_, Jul 05 2017