## number theory – Does this limit sum equals the Euler-Mascheroni constant?

Let $$zeta(s)$$ be the Riemann zeta function and $$gamma$$ be the Euler-Mascheroni constant. I observed the following result empirically. Looking for a proof or disproof.

$$lim_{n to infty}sum_{k = 1}^n zetaBig(k – frac{1}{n}Big) = gamma$$

Also, I searched for different summation formulas for the Euler-Mascheroni constant using the Riemann zeta function but could not find it any. Is there any reference to his sum in literature?

## Sum rule for Big-O with equal complexity-functions?

One property of the Big-O-notation is the sum rule, which states that when I have two functions $$f1$$ and $$f2$$ and their corresponding complexity functions are $$g1$$ and $$g2$$, then the combined complexity is $$f1 + f2 = O(max(g1, g2))$$.

But what do we pick if both complexity-functions are equal? E.g., if $$f1(n)$$ is the sorting of an array and $$f2(m)$$ as well, then the complexities are $$O(nlog(n))$$ and $$O(mlog(m))$$. Applying the rule would be $$O(max(nlog(n), mlog(m)))$$. I think that picking any of those would yield a valid but very unintuitive estimation as you would drop one variable. Besides that, it’s not clear which one to pick.

Is it the case that you are not supposed to use the rule when there are multiple variables involved?

## sql server – how to sum sales after MAX purchasing date in SQL

Select “Item No_”,
MAX(case when (“Entry Type” IN (0,4)) and (“Quantity” >0) then “Posting Date” else 0 end) as “PUR DATE”,
MAX(case when “Entry Type” =1 then “Posting Date” else 0 end) as “Sales Date”,
Sum(case when (“Entry Type” IN (1)) then “Quantity” else 0 end) as “Sales QTY”
From “HONAV”.”dbo”.”HO\$Item Ledger Entry”
where (“Location Code”=’MAZ’) and (“Item Category Code” IN (0101))
Group by “Item No_”
having MAX(case when (“Entry Type” IN (0,4)) and (“Quantity” >0) then “Posting Date” else 0 end)>”Posting Date”

## java – Largest Sum Contiguous Subarray – Kadene’s algorithm

I am looking forward to an answer to improve this code?

Thanks.

Test class

``````package test;

import main.algorithms.LargestSumContiguousSubarray;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class LargestSumContiguousSubarrayTest {

LargestSumContiguousSubarray largestSumContiguousSubarray;

@Before
public void setUp(){
largestSumContiguousSubarray = new LargestSumContiguousSubarray();
}

@Test
public void testSumContiguousSubArray(){
int() a = {-2, -3, 4 - 1, -2, 1, 5, -3};
int sum = 7;
}

}
``````

LargestSumContiguousSubarray.java class

``````package main.algorithms;

public class LargestSumContiguousSubarray {

// O(n)

// This is also works for negative numbers
int max_so_far = a(0);
int curr_max = a(0);

for(int i=0;i<a.length; i++){
curr_max = Math.max(a(i), curr_max+a(i));
max_so_far = Math.max(max_so_far, curr_max);
}
return max_so_far;
}
}
``````

## Import and SUM chosen (from drop-down) column to Sheet1 from Sheet2

What formula I can use in cell C2 to import one column from sheet 2 using a drop-down list?

Here’s the document.

## matrices – Understanding Sum Property of determinants

If $$A=B+C$$, where $$B=begin{bmatrix}a &b &c\ d& e& f\ g &h& iend{bmatrix}$$ and $$C=begin{bmatrix}k &k &k\ 0& 0& 0\ 0 &0& 0end{bmatrix}$$, then $$|A|=|B|+|C|$$. Since $$|C|=0$$, so, $$|A|=|B|$$.

But, if we consider the properties of determinants, then $$left| begin{array}{c c c} a+k & b+k & c+k \ d & e & f \ g & h & i end{array}right|=left| begin{array}{c c c} a & b & c \ d & e & f \ g & h & i end{array}right|+left| begin{array}{c c c} k & k & k \ d & e & f \ g & h & i end{array}right|$$. Thus, $$|A|ne|B|$$.

What is wrong in the first method?

## Given N intervals and each interval has a cost, how’d you find the maximum sum of any two non overlapping intervals in (NlogN) given 2<=N<=100000

This was asked by Amazon in their campus dive.

## np complete – Complexity of Subset Sum where the size of the subset is specified

There are $$binom{n}{k}$$ $$k$$-subsets of an $$n$$ set, and $$binom{n}{k} = n (n – 1) dotsm (n – k + 1) / k!$$, which is $$O(n^k)$$, as you observe. The brute force complexity is a bit more (need to add up the numbers too and check), but that is ballpark.

This is polynomial for any fixed $$k$$, but not polynomial in $$n$$ if e.g. $$k = n / 2$$ (that is the Partition problem, known NP-complete).

## programming languages – Terms for different models of sum types

There seem to be at least a couple different possible ways of modeling sum types in a type system, but I haven’t been able to find consistent terms for referring to them:

1. A sum type is formed from a set of “data constructors”, which are function-like entities that notionally map values of a summand type to values of the sum type. This is the model adopted by e.g. Haskell and the various flavors of ML.

2. A sum type is formed directly from the underlying summand types, with no data constructors, and as a consequence the sum type is a supertype of the summands (or at least behaves very much like one). This model seems to be much less common, but it’s the model adopted by Ceylon, and by C++’s `std::variant`.

Note that this is separate from the distinction between discriminated and non-discriminated unions: both models permit the sum type to be discriminated (although only if the summands are disjoint, in the case of #2).

Are there settled terms for distinguishing these two models?

## Find the probability that the sum of variables will be 46

Variables $$X_{1},X_{2},….,X_{20}$$ are identically distributed random variables that take only values 2 and 3. Value 3 is taken with a probability of 0.2. What is the the probability that the sum of variables will be 46. I really don’t know hot to calculate all possible compninations pro bailies to sum them after