## Prove that the number of circuits with bounded fan-in (of 2) of size $s$ is at most $s^{O(s)}$

Prove that the number of circuits with bounded fan-in (of 2) of size $$s$$ is at most $$s^{O(s)}$$.
Give the best explicit bound you can get.

I know that for a circuit of size $$s$$ in order to generate a string to represent it I need for every edge, which I have at most $$s$$ of those, to represent from which vertice it start and in which vertice it ends and for that I need $$2s log(s)$$ bits.
In addition I need another 2 bit for every vertice to mark whether it is an input, an OR AND NOT Gate.
So overall I need $$O(s log(s))$$ bits to represent a circuit, and there are $$2^{O(s log(s))} = s^{O(s)}$$ circuits like that.

Am I in the right direction or am I missing something? And is $$2^{3(s log(s))} = 8s^{O(s)}$$ the bound?
Thanks:)

## sharepoint online – Conditional formatting based on number of days to due date

In SharePoint 0365, in the modern experience, I have a list of
contracts that have an expiration date.

I would like to use conditional formatting to create a status
column that shows me the contract is one of these:

1. Active, Green background – due date is more than 4 month from today.
2. Expiring, Orange background – due date is between 4 month from today and today.
3. Expired, Red background – due date is past one day.

I’m trying to get this for while now without success. I matched the formulas in Excell where they’re working.

This is the code I’m trying:

{
"elmType": "div",
"style": {
"background-color": "=if(($DueDate) > @now + 1036800000 ,'green', (if(($DueDate) - @now >= 0, '#ffa59b','red'))"
},
"children": (
{
"elmType": "span",
"txtContent": "=if(($DueDate) > @now + 1036800000 ,'Current', (if(($DueDate) >= @now - 10368000000, 'Expiring','Expired'))",
"style": {
"color": "white"
}
}
)
}


And this is the result I get: Here is the working formula tested in Excel, I’m trying to convert in JSON : =IF(B16>TODAY()+120,”green”,IF(B16-TODAY()>=0,”orange”,”red”)) where B16 is the cell containing the contract due date.

Posted on Categories Articles

## python – Finding the number of moves a knight can perform while standing on a given square

Python already has a function called map()
Defining your new map() function can cause a lot of confusion, and undefined behaviour in your program.

Since you have asked for an alternate solution, here it is

Being a chess engine developer, I would never calculate something trivial like the number of knight attacks since a simple array of size 64 with the pre-calculated ones can easily work. All you need is a simple function that converts a square like a1 to 0 and h8 to 63.

Here is the implementation,

def str_sq_to_int(sq):
return (ord(sq(0))-97) + ((ord(sq(1))-49) * 8);

def knightAttacks(cell):
attacks = (
2, 3, 4, 4, 4, 4, 3, 2,
3, 4, 6, 6, 6, 6, 4, 3,
4, 6, 8, 8, 8, 8, 6, 4,
4, 6, 8, 8, 8, 8, 6, 4,
4, 6, 8, 8, 8, 8, 6, 4,
4, 6, 8, 8, 8, 8, 6, 4,
3, 4, 6, 6, 6, 6, 4, 3,
2, 3, 4, 4, 4, 4, 3, 2
)
return attacks(str_sq_int(cell))


The explanation is simple, the function str_sq_int() takes a square like 'a1' and returns an index using the ASCII value of the character to calculate the index. You can also use a simple dictionary to map each square to an index, but this one is easy

Then, it uses a pre-calculated set of values, to return the correct answer.

Posted on Categories Articles

## number theory – Radix Economy of Complex Bases

If we extend the allowed bases for a numerical system to the complex numbers, is e still the most economic base? If not, what would it be?

There’s the well-known formula for radix economy: Where b is the base, and N is a given number.

I don’t know if this formula is still valid for complex numbers. Nonetheless, the only local minimum this function seems to have, even extended over the complex numbers, is at b = e + 0i.

## abstract algebra – Number of group homomorphism from the group $D_{8}$ to $Q^{×}$

How to determine the number of group homomorphism from $$D_{8}$$ to $$Q^{×}$$ .

For any homomorphism $$f$$, $$o(f(x))$$ divides $$o(x)$$, in case of both being finite.
Here $$Q^{×}$$ has only two elements with finite order while each element in $$D_{8}$$ is of finite order.

And in $$D_{8}$$, for generators y and x, we have $$yx = xy^{-1}$$ where $$y^{2}= e = x^{4}$$ .

I need a hint to proceed further.

Posted on Categories Articles

## performance tuning – Finding the number of appearances that a number turns up in a certain list of numbers

I have the following code:

max = 4000; Clear[cnt];
cnt[_] = 0; Do[b = Binomial[n + 2, k + 1];
If[b <= max, cnt[b] += 1], {n, 0, max}, {k, 1, n - 1}]; sel =
Select[Table[{b, cnt[b]}, {b, 1, max}], #[] >= 1 &];
a[n_] := Select[sel, #[] >= n &][[1, 1]];
Quiet@Array[a, 10^3] /. {}[[1, 1]] -> Nothing


The code is finding the number of appearances that a number turns up in a certain list of numbers. Is there a way to speed up this calculation, because it takes a while.

Posted on Categories Articles

## number theory – $n!+1$ is composite for infinitely many odd $n$

It’s the number theory problem from Thailand Mathematical Olympiad. That require one to prove that $$n!+1$$ is composite for infinitely many odd $$n$$.

It’s true if $$n$$ is even from Wilson’s theorem directly that $$p text { } Big|Big((p-1)!+1Big)$$ but for odd $$n$$ I have no idea about it. I’ve tried for prime $$p$$ of the form $$4k+3$$ and we’ll have that $$left(dfrac{p-1}{2}right)!equivpm 1pmod p$$ and maybe there is infinitely many cases that $$left(dfrac{p-1}{2}right)!equiv -1pmod p$$, but I don’t know how to prove it and I don’t think this is a good way to tackle this problem.

I, actually, saw someone’s proof before but I didn’t pay attention at much and didn’t jot down the idea. All in my memory is that he used Bertrand postulate and something in the double factorial like $$(n!+1)!+1$$. Any help would be really appreciate and thank you in advance.

Posted on Categories Articles

## number theory – How to proceed with the proof

Thanks for contributing an answer to Mathematics Stack Exchange!

But avoid

• Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

## How to combine Excel sheets horizontally (fixed number of rows)?

I have a workbook with dozens of different sheets that have the same structure (see exemplary sheet 1).

What I need to do is combine all sheets into one by “pasting” all columns of all sheets alongside each other such that in the sheet containing all the data I still have N number of rows (i.e. as many rows as there are countries, see screenshot 2 for how I need my resulting sheet to look like).

I would be extremely grateful for any tips!

Posted on Categories Articles

## number theory – Most efficient solution to find polynomial congruence for 0 mod p

I was given the polynomial $$f(x) = x^4 + 2x^3 + 3x^2 + x + 1$$ and told to find $$f(x) mod 17 = 0$$ I found the solution to be $$x = 8 + 17n$$ However, I arrived at this solution by computing all of the residues of f(x) mod 17 and then finding where the zero occurred. I was told by the person who gave me the problem that there’s a more efficient solution that doesn’t involve making a list. I’m quite new to number theory, so I don’t know where to look to ask the question in a more advanced way, need guidance to be able to. Thank you kindly if you can.

TL;DR: Looking for a more number theoretic way to solve for x than computing f(x) from 1 to 17

Posted on Categories Articles