%I M0504 #32 Sep 12 2023 12:02:28
%S 0,0,0,0,1,2,3,4,5,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,
%T 40,42,44,46,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,97,100,
%U 103,106,109,112,115,118,121,124,127,130,133,136,139
%N Number of low discrepancy sequences in base 4.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Harald Niederreiter, <a href="http://dx.doi.org/10.1016/0022-314X(88)90025-X">Low-discrepancy and low-dispersion sequences</a>, J. Number Theory 30 (1988), no. 1, 51-70.
%F Let N(b,n) = (1/n) * Sum_{d|n} mobius(n/d) * b^d. Let M(b,n) = Sum_{k=1..n} N(b,k) with M(b,0) = 0. Let r = r(b,n) be the largest value r such that M(b,r) <= n. Then a(n) = r * (n - M(4, r)) + Sum_{h=1..r} (h-1) * N(4, h) [From Niederreiter paper]. - _Sean A. Irvine_, Jun 07 2016
%F G.f.: z^4 * (z^2+1) * (z^4-z^2+1) / (z-1)^2; [Conjectured by _Simon Plouffe_ in his 1992 dissertation, but is incorrect.]
%p N := proc(b,n)
%p option remember;
%p local d;
%p add(b^d*numtheory[mobius](n/d),d=numtheory[divisors](n)) ;
%p %/n ;
%p end proc:
%p M := proc(b,n)
%p local h;
%p if n = 0 then
%p 0;
%p else
%p add(N(b,h),h=1..n) ;
%p end if;
%p end proc:
%p nMax := proc(b,s)
%p local n;
%p for n from 0 do
%p if M(b,n) > s then
%p return n-1 ;
%p end if;
%p end do:
%p end proc:
%p A005377 := proc(s)
%p local n,b;
%p b := 4 ;
%p n := nMax(b,s) ;
%p n*(s-M(b,n))+add( (h-1)*N(b,h),h=1..n) ;
%p end proc:
%p seq(A005377(n),n=1..40) ; # _R. J. Mathar_, Jun 09 2016
%t Np[b_, n_] := Np[b, n] = Sum[b^d*MoebiusMu[n/d], {d, Divisors[n]}]/n;
%t M[b_, n_] := If[n == 0, 0, Sum[Np[b, h], {h, 1, n}]];
%t nMax[b_, s_] := Module[{n}, For[n = 0, True, n++, If[M[b, n] > s, Return[n - 1]]]];
%t a[s_] := Module[{n, b}, b = 4; n = nMax[b, s]; n*(s - M[b, n]) + Sum[(h - 1)*Np[b, h], {h, 1, n}]];
%t Table[a[n], {n, 1, 61}] (* _Jean-François Alcover_, Sep 12 2023, after _R. J. Mathar_ *)
%Y Cf. A005356 (base 2), A005357 (base 3), A005358 (base 5), A274039 (Plouffe's g.f.)
%Y Cf. A001037 (N(2,n)), A027376 (N(3,n)), A027377 (N(4,n)), A062692 (M(2,n)), A114945 (M(3,n)), A114946 (M(4,n)).
%K nonn,easy
%O 1,6
%A _N. J. A. Sloane_, _Simon Plouffe_
%E Terms, offset, and formula corrected by _Sean A. Irvine_, Jun 07 2016