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.
%I A300903 #30 Mar 18 2018 09:49:35 %S A300903 1,2,3,4,5,6,7,9,9,10,15,12,13,14,15,16,48,0,19,0,21,22,0,24,25,0,27, %T A300903 54,36,30,31,33,96,34,0,36,37,0,0,40,41,42,0,0,45,0,0,0,49,0,51,52,0, %U A300903 54,55,66,57,0,0,0,61,0,63,64,192,66,0,0,69,70,0,0,0,0,75,76,0,0,79,0,0,82,0,84,85,0,87,0,0,90,91,0,0,0,0,96,97 %N A300903 a(n) is the smallest k such that k^2 - n^2 is a prime power (A000961), or 0 if no such k exists. %C A300903 If such k exists (for n > 0), then the maximum ratio of k / n is (p + 1)/(p - 1) with p = 2 where p is prime root of corresponding prime power. So a(n) <= 3*n. %C A300903 If 2*n+1 is in A000961 (in particular if n is in A005097), then a(n) = n + 1. %C A300903 Numbers n such that a(n) = 0 are 17, 19, 22, 25, 34, 37, 38, 42, 43, 45, 46, ... %C A300903 Initial corresponding prime powers are 1, 3, 5, 7, 9, 11, 13, 32, 17, 19, 125, 23, 25, 27, 29, 31, 2048. %e A300903 a(17) = 0 because there is no k such that k^2 - 17^2 = (k + 17)*(k - 17) is a prime power. %e A300903 a(21) = 22 because 22^2 - 21^2 = 43 and 22 is the least number with this property. %e A300903 a(27) = 54 because 54^2 - 27^2 = 3^7 and 54 is the only number with this property. %p A300903 f:= proc(n) local p,k,a,b,r; %p A300903 if nops(numtheory:-factorset(2*n+1))<=1 then return n+1 fi; %p A300903 k:= infinity; %p A300903 for p in numtheory:-factorset(2*n) do %p A300903 b:= padic:-ordp(2*n,p); %p A300903 r:= 2*n + p^b; %p A300903 a:= padic:-ordp(r,p); %p A300903 if r = p^a then %p A300903 k:= min(k, (p^a+p^b)/2) %p A300903 fi %p A300903 od; %p A300903 if k = infinity then 0 else k fi %p A300903 end proc: %p A300903 map(f, [$0..1000]); # _Robert Israel_, Mar 15 2018 %t A300903 Table[Boole[n == 0] + Block[{k = n + 1, m = 3 n}, While[Nor[PrimePowerQ[k^2 - n^2], k > m], k++]; If[k > m, 0, k]], {n, 0, 96}] (* _Michael De Vlieger_, Mar 16 2018 *) %o A300903 (PARI) a(n) = if(n==0, 1, for(k=n+1, 3*n, if(isprimepower(k^2-n^2), return(k)));0) %Y A300903 Cf. A000961, A005097, A024352. %K A300903 nonn,easy %O A300903 0,2 %A A300903 _Altug Alkan_, Mar 14 2018