A225889
Least prime p_m such that n = p_m-p_{m-1}+...+(-1)^(m-k)*p_k for some 0
3, 5, 7, 5, 7, 11, 13, 11, 11, 17, 19, 17, 17, 23, 17, 23, 23, 31, 23, 41, 23, 41, 31, 47, 29, 47, 37, 59, 41, 59, 37, 59, 43, 67, 37, 67, 43, 67, 43, 73, 61, 83, 53, 83, 47, 101, 61, 97, 53, 97, 59, 97, 59, 103, 61, 109, 67, 127, 67, 131
Offset: 1
Keywords
Examples
a(7) = 13 since 7 = 13-11+7-5+3. a(20) = 41 since 20 = 41-37+31-29+23-19+17-13+11-7+5-3.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Zhi-Wei Sun, On functions taking only prime values, J. Number Theory 133(2013), no.8, 2794-2812.
Programs
-
Mathematica
s[0_]:=0 s[n_]:=s[n]=Prime[n]-s[n-1] Do[Do[If[s[j]-(-1)^(j-i)*s[i]==m,Print[m," ",Prime[j]];Goto[aa]],{j,PrimePi[m]+1,PrimePi[2m+2.2Sqrt[m]]},{i,0,j-2}]; Print[m," ",counterexample];Label[aa];Continue,{m,1,100}]
Comments