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 A059876 #16 Mar 07 2016 04:41:01 %S A059876 2,1,3,3,5,7,9,-1,1,3,5,5,7,9,11,3,5,7,9,9,11,13,15,13,15,17,19,19,21, %T A059876 23,25,-7,-5,-3,-1,-1,1,3,5,3,5,7,9,9,11,13,15,7,9,11,13,13,15,17,19, %U A059876 17,19,21,23,23,25,27,29,-3,-1,1,3,3,5,7,9,7,9,11,13,13,15,17,19,11,13,15,17,17,19,21,23,21,23,25,27,27,29,31,33,19,21,23,25,25,27,29,31,29,31 %N A059876 a(n) = bin_prime_sum(n). %C A059876 From _R. J. Mathar_, Nov 12 2011: (Start) %C A059876 The function bin_prime_sum of an argument n is a sum of three numbers. Let s = A000523(n) be the exponent of the largest power of 2 less than or equal to n and prime=A000040. Then the three terms are: %C A059876 i) (-1)^(n+1); %C A059876 ii) sum_{i=1..s} prime(i) * (1 + (-1)^[n/2^i] ); where [..] is the floor bracket; %C A059876 iii) 1 (if n=1), otherwise prime(s) (if s even) or 0 (if s odd). (End) %F A059876 a(A059873(n)) = A000040(n). %p A059876 with(numtheory); bin_prime_sum := proc(n) local i,s; s := floor_log_2(n); RETURN(((-1)^(n+1)) + add( (((-1)^(floor(n/(2^i))+1))*ithprime(i)),i=1..s) + (`if`((1 = n),1,((`mod`((s+1),2))*ithprime(s)))) ); end; %t A059876 a[n_] := With[{s = Floor[Log[2, n]]}, (-1)^(n+1) + Sum[(-1)^(Floor[n/2^i] + 1)*Prime[i], {i, 1, s}] + If[1 == n, 1, Mod[s+1, 2]*Prime[s]]]; Array[a, 105] (* _Jean-François Alcover_, Mar 07 2016, adapted from Maple *) %Y A059876 Cf. A059871, A059872, A059873, A059877, A059878, A059880. %K A059876 sign %O A059876 1,1 %A A059876 _Antti Karttunen_, Feb 05 2001