## python – Selects a group of consecutive dates in the random column datas / pandas

I have a data column of pandas where the dates are not sorted. I want to select all the dates for which the next 6 consecutive dates are available in the column, without there being no day.

My data looks like this: [pandas dataframe] and I have marked the date I want in the picture.

## Minimum size of a maximum set of primary numbers in a finite sequence of consecutive integers

Given the positive integers $$n$$ and $$k$$, consider the finite sequence of consecutive integers $$n, n + 1, dotsc, n + k-1$$, noted by the interval $$[n,n+k-1]$$. We would like to find a maximum subset $${a_1, a_2, dotsc, a_t }$$ it's in relatively prime pair. Set the maximum size (not only maximum) per $$F (n, k) = max t$$. We are interested in the minimum value of $$F (n, k)$$ more than $$n$$, that is to say., $$s (k) = min_n F (n, k)$$. In other words, we are interested to know that among all the $$k$$ positive integers, how many coprime numbers per pair we can make sure to find.

In the document entitled "Completing the First Integral Integer Subsets" of P. Erdős and J. L. Selfridge on the Proceedings of the Manitoba Conference on Digital Mathematics, Winnipeg (1971), it was found that $$s (k) geq k ^ { frac {1} {2} – epsilon}$$. However, they also mention that the true value of $$s (k)$$ is probably closer to $$frac {k} { log k}$$. Our question is: is there a way to improve this situation? $$k ^ { frac {1} {2}}$$? Is there any other literature that has worked on this problem?

Another related question. In the same sequence over consecutive integers $$[n,n+k-1]$$we would like to find a minimal set of prime numbers $${p_1, p_2, dotsc, p_ tau }$$ which "covers" the entire interval, that is to say each integer of $$[n,n+k-1]$$ is divisible by some $$p_i$$, or $$1 leq i leq tau$$. Set minimum size (not only minimal) $$g (n, k) = min tau$$. We are interested in the minimum value of $$g (n, k)$$ more than $$n$$, that is to say., $$t (k) = min_n g (n, k)$$. In other words, we are interested to know that among all the $$k$$ positive integers, how many prime numbers we must have to cover the interval.

It's obvious that $$t (k) geqs (k)$$. Again, our question is this: Is it true that $$t (k) geq k ^ { frac {1} {2}}$$?

## Can I attend two consecutive conferences in two EU countries with a single Shengen visa?

I am attending twice in a row in two different European countries. I have time to apply for a single visa. Is it possible to travel without a problem from one Shengen country to another?

## performance – (Leetcode) The longest consecutive sequence in Python

This is a Leetcode problem –

From an unsorted integer array, find the length of the longest
sequence of consecutive elements.

Your algorithm should work in $$O (n)$$ complexity.

Example –

``````Contribution: [100, 4, 200, 1, 3, 2]
Released: 4

# Explanation: The longest sequence of consecutive elements is [1, 2, 3, 4]. So its length is 4.
``````

Here is my solution to this challenge –

``````def longestConsecutive (nums):
"" "
: type nums: list[int]
: rtype: int
"" "
otherwise nums:
returns 0

nums = list (dict.fromkeys (nums))
nums.sort ()
account = 1
longest_streak = []

for index, value enumerate (nums):
if index + 1> = len (nums):
Pause

if nums[index + 1] == value + 1:
account + = 1
longest_streak.append (count)
other:
account = 1

otherwise longest_streak:
return account

returns max (longest_streak)
``````

Here is my result Leetcode –

I would like to know if I could make this program faster and more efficient.

NOTE – Although my solution has been accepted, I have no idea of ​​the time complexity of my program. Maybe someone could cover that too?

## Portfolio hd – Gap Limit reserved for consecutive addresses?

Suppose we have generated 35 addresses, 1-5 are paid, 6 to 34 unpaid / used and 35 paid.
Because of the limit of 20 deviations, we will not see a 35 in our portfolio, but what happens if we send money to address, for example, that will solve the problem. of the vacuum limit because even when the address 28 is not used yet, they are not used a row?

## javascript – Length of the longest consecutive series of 1 in its binary representation

Given an integer n, returns the length of the longest consecutive series
of 1 in its binary representation.

For example, for 156, you should return 3

My solution of function 1

Style 1

``````findMaxNumberOfConsecOnes (dec) {function
const countConsecOnes = (acc, x) => [acc[0] < acc[1]
? acc[1]
: acc[0],
x === "1"
? acc[1] + 1
: 0 ];

return [...(dec >>> 0) .toChain (2)].reduce (countConsecOnes, [0,0])
}
``````

Style 2

``````findMaxNumberOfConsecOnes (dec) {function
const countConsecOnes = (acc, x) => [acc[0] < acc[1] ? acc[1] : acc[0],
x === "1" ? acc[1] + 1 : 0 ];

return [...(dec >>> 0) .toChain (2)].reduce (countConsecOnes, [0,0])
``````

Style 1 and Style 2 have exactly the same logic, but a different style. My first idea was to write it in Style 1. But then I thought about what I had said in this thread about indentation. So I'm opting for Style 2. But still not sure if that is the right way.

Alternately:

My functional solution 2

``````findMaxNumberOfConsecOnes (dec) {function
return [...(dec >>> 0).toString(2)]
.reduce ((acc, x) => {
const current = x === "1"? access[1] +1: 0;
const max = Math.max (acc[0], current);
return [max, current];
} [0,0])
}
``````

My imperative solution

``````findMaxNumberOfConsecOnes (dec) {function
const binStr = (dec >>> 0) .toString (2);
leave max = 0, current = 0;
for (const of binStr) {
current = s === "1"? current + 1: 0;
max = Math.max (max, current);
}
back max;
}
``````

## Germany – Consecutive visa applications

About a month ago, I applied for a tourist visa to visit my wife in Germany. Recently, I received a contract letter from a German company. I therefore need a national visa to travel and work there. Consecutive visa applications (eg tourist visa and national visa) in Germany? I'm a little worried about that. Thanks for letting me know.

## infinite – Is it possible to compute consecutive digits of \$ pi ^ {1 / pi} \$

This question is inspired by a challenge launched on codegolf.stackexchange.com, where the task is to:

Displays consecutive numbers of $$x = pi ^ {1 / pi}$$ forever.

That is, calculate the numbers of $$x$$, and output one by one forever (in theory). As it should last forever, you need to continuously calculate new numbers of $$pi$$ and $$x$$. There are known methods for calculating individual $$pi$$but as far as I know, figure $$n$$ of $$pi ^ {1 / pi}$$ can count on the number $$n + m$$ of $$pi$$.

At some point you will come across something like $$… 1999999999999999 …$$ if you calculate $$x$$ with a precision given for $$pi$$. However, if you had a higher accuracy, this could result in $$… 200000000000 …$$ instead of.

I am pretty sure that it can be proved / shown this figure $$n$$ can count on the number $$n + m$$ of $$pi$$ for some people $$n$$ and $$m$$ (but I can not). What I'm not sure is that an upper limit of $$m$$ to be proven? Is it possible to say with absolute certainty that the $$n$$th figure of $$x$$ is correct if we calculated for example $$x + 10$$ figures of $$pi$$?

## SQL server – Count consecutive codes

I am looking for a query (I can not understand it myself for the moment with the help of queries already found here.) The quest I have is: I have a view that gives the next exit

``````ResourceID ReferenceDate CodeID
893 2018-05-14 1
656 2018-05-07 1
656 2018-05-22 1
353 2018-05-07 1
530 2018-05-07 1
541 2018-05-07 1
755 2018-05-07 1
55 2018-05-07 1
382 2018-05-07 1
224 2018-05-07 1
1115 2018-05-07 1
191 2018-05-07 5
191 2018-05-08 5
191 2018-05-09 5
655 2018-07-06 6
655 2018-07-10 6
892 2018-07-06 6

``````

I want to group the CodeIDs with a sort by ResourceID and then ReferenceDate. With this result I want to get something like the following table

``````ResourceID CodeID Count
893 1 1
656 1 2
353 1 1
...
191 5 3
655 6 2
892 6 1
``````

This to arrive at a result where we can say that ResourceNumber x has y consecutive days CodeID z.

## characteristic co-prime of consecutive number powers

Lemma: For each list of powers of consecutive numbers, prove that at least one of the numbers is equal to their sum.