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 A047949 #58 Jul 01 2018 14:46:03 %S A047949 0,0,1,2,1,4,5,4,7,8,7,10,9,8,13,14,13,12,17,16,19,20,19,22,21,20,25, %T A047949 24,23,28,29,28,27,32,31,34,35,34,33,38,37,40,39,38,43,42,41,30,47,46, %U A047949 49,50,49,52,53,52,55,54,53,48,51,50,45,62,61,64,63,62,67,68,67,66 %N A047949 a(n) is the largest m such that n-m and n+m are both primes, or -1 if no such m exists. %C A047949 A067076 is a subsequence of this sequence: when 2m+3 is prime a(m+3) = m. Moreover, it is the subsequence of records (maximal increasing subsequence): let m=a(n), with p=n-m and q=p+2m both odd primes > 3; now 3+2(m+(p-3)/2)=q and hence a(3+m+(p-3)/2) >= m+(p-3)/2 > m = a(n) but 3+m+(p-3)/2 < n. - _Jason Kimberley_, Aug 30 2012 and Oct 10 2012 %C A047949 Goldbach's conjecture says a(n) >= 0 for all n. - _Robert Israel_, Apr 15 2015 %C A047949 a(n) is the Goldbach partition of 2n which results in the maximum spread divided by 2. - _Robert G. Wilson v_, Jun 18 2018 %H A047949 T. D. Noe, <a href="/A047949/b047949.txt">Table of n, a(n) for n = 2..10000</a> %H A047949 OEIS (Plot 2), <a href="/plot2a?name1=A067076&name2=A098090&tform1=untransformed&tform2=untransformed&shift=0&radiop1=xy&drawpoints=true">A067076 vs A098090</a> (n-m=3). - _Jason Kimberley_, Oct 01 2012 %F A047949 a(n) = n - A020481(n). %F A047949 a(n) = (A020482(n) - A020481(n))/2. - _Gionata Neri_, Apr 15 2015 %e A047949 49-30=19 and 49+30=79 are primes, so a(49)=30. %p A047949 a:= proc(n) %p A047949 local k; %p A047949 for k from n - 1 to 0 by -2 do %p A047949 if isprime(n+k) and isprime(n-k) then return(k) fi %p A047949 od: %p A047949 -1 %p A047949 end proc: %p A047949 0, seq(a(n),n=3..1000); # _Robert Israel_, Apr 16 2015 %t A047949 a[2] = a[3] = 0; a[n_] := (For[m = n - 2, m >= 0, m--, If[PrimeQ[n - m] && PrimeQ[n + m], Break[]]]; m); Table[a[n], {n, 2, 100}] (* _Jean-François Alcover_, Sep 04 2013 *) %t A047949 lm[n_]:=Module[{m=n-2},While[!AllTrue[n+{m,-m},PrimeQ],m--];m]; Join[{0,0}, Array[ lm,70,4]] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Dec 03 2014 *) %t A047949 f[n_] := Block[{q = 2}, While[q <= n && !PrimeQ[2n -q], q = NextPrime@ q]; n - q]; Array[f, 72, 2] (* _Robert G. Wilson v_, Jun 18 2018 *) %o A047949 (PARI) a(n) = {if (n==2 || n==3, return (0)); my(m = 1, lastm = -1, do = 1); while (do, if (isprime(n-m) && isprime(n+m), lastm = m); m++; if (m == n - 1, do = 0);); return (lastm);} \\ _Michel Marcus_, Jun 09 2013 %o A047949 (PARI) a(n)=if(n<4,0,forprime(p=3,n-1,if(isprime(2*n-p),return(n-p)));-1) \\ _Ralf Stephan_, Dec 29 2013 %o A047949 (Haskell) %o A047949 a047949 n = if null qs then -1 else head qs where %o A047949 qs = [m | m <- [n, n-1 .. 0], a010051' (n+m) == 1, a010051' (n-m) == 1] %o A047949 -- _Reinhard Zumkeller_, Nov 02 2015 %Y A047949 Cf. A047160, A067076, A182138. %Y A047949 Cf. A020481. %Y A047949 Cf. A010051. %K A047949 easy,nice,nonn %O A047949 2,4 %A A047949 _Lior Manor_ %E A047949 Corrected by _Harvey P. Dale_, Dec 21 2000