Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #7 Sep 14 2013 17:42:34
%S 2,3,4,5,1,7,2,6,3,11,1,13,5,2,4,17,2,19,1,4,9,23,1,10,11,3,3,29,4,31,
%T 2,8,15,2,2,37,17,10,1,41,2,43,7,1,21,47,1,14,2,14,9,53,1,6,1,16,27,
%U 59,2,61,29,1,4,8,6,67,13,20,4,71,2,73,35,3,15,4,8,79,1,6,39,83,4,12,41,26,5
%N Least positive number that can be written using prime factors of n (with repetition) and the operations add and subtract.
%C a(n) <= A001414(n); a(n)=A001414(n)=n iff n is prime.
%H Donovan Johnson, <a href="/A081806/b081806.txt">Table of n, a(n) for n = 2..1000</a>
%e 24=2*2*2*3 -> a(24) = 2-2-2+3 = 1;
%e 30=2*3*5 -> a(30) = 2-3+5 = 4, as -2-3-5<1, -2-3+5<1, -2+3-5<1, -2+3+5>4, 2-3-5<1, 2+3-5<1 and 2+3+5>4.
%o (PARI) v=vector(9); for(n=2, 1000, c=0; f=factorint(n); for(j=1, omega(n), for(h=1, f[j,2], c++; v[c]=f[j,1])); nn=997; for(j=0, 2^c-1, s=0; for(h=0, c-1, if(bittest(j,h)==0, s=s-v[h+1], s=s+v[h+1])); if(s>0, if(s<nn, nn=s))); write("b081806.txt", n " " nn)) /* _Donovan Johnson_, Sep 14 2013 */
%Y Cf. A082729, A001222.
%K nonn
%O 2,1
%A _Reinhard Zumkeller_, Apr 10 2003