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.

A287016 a(n) = smallest number k such that A071904(n) + k^2 is a perfect square.

This page as a plain text file.
%I A287016 #41 Aug 02 2024 17:06:28
%S A287016 0,1,2,0,3,4,1,5,2,0,7,3,8,1,4,10,5,2,0,6,13,3,14,7,1,4,17,9,2,5,0,19,
%T A287016 10,20,6,3,22,1,12,7,4,13,25,8,2,0,5,9,28,29,16,3,6,1,32,11,18,7,4,34,
%U A287016 19,12,35,2,0,5,21,38,9,14,3,40,6,1,15,10,24
%N A287016 a(n) = smallest number k such that A071904(n) + k^2 is a perfect square.
%F A287016 a(m) = 0 for m>0 in A037040, the corresponding odd composites being in A016754\{1}. - _Michel Marcus_, May 19 2017
%e A287016 The third odd composite number is A071904(3) = 21. and 21+2^2 = 25 = 5^2, so a(3) = 2.
%t A287016 q[n_] := SelectFirst[Range[0, (n-1)/2], IntegerQ@ Sqrt[#^2 + n] &]; q /@ Select[Range[1, 300, 2], CompositeQ] (* _Giovanni Resta_, May 18 2017 *)
%o A287016 (Python)
%o A287016 from sympy import primepi, divisors
%o A287016 from sympy.ntheory.primetest import is_square
%o A287016 def A287016(n):
%o A287016     if n == 1: return 0
%o A287016     m, k = n, primepi(n) + n + (n>>1)
%o A287016     while m != k:
%o A287016         m, k = k, primepi(k) + n + (k>>1)
%o A287016     return 0 if is_square(int(m)) else -(d:=divisors(m))[l:=(len(d)>>1)-1]+d[l+1]>>1 # _Chai Wah Wu_, Aug 02 2024
%Y A287016 Cf. A016754, A037040, A071904.
%Y A287016 Subsequence of A068527.
%K A287016 nonn,easy
%O A287016 1,3
%A A287016 _Zhandos Mambetaliyev_, _Jean-François Alcover_, May 18 2017
%E A287016 More terms from _Giovanni Resta_, May 18 2017