How many dense disjoint subsets, totally disconnected by pairs, does $ mathbb {R} $ have (in the standard topology)?

Problem: How many dense subsets disjoint, totally disconnected in pairs $ mathbb {R} $ have (in the standard topology)?

This is how I did it. I am not sure if this is correct or not. I know I have the idea, but I can't say positively if this will work or not.

Leave $ p in mathbb {R} $such that $ p notin mathbb {Q} $that is to say $ p in mathbb {Q ^ {C}} $. So, let's consider 2 open sets $ S $ Y $ T $such that $ S = mathbb {Q} cup $ {p} and $ T = mathbb {Q ^ {C}} $ {P}. So both $ S $ Y $ T $ they are dense in $ mathbb {R} $. Too, $ S cap T $ = $ emptyset $that is to say $ S $ Y $ T $ they are disjoint so I guess we can show that $ S $ Y $ T $ they are both a totally disconnected subset of $ mathbb {R} $ as previously. can i say that $ (S, T) $ is a pair, such that $ S $ Y $ T $ are disjoint and both are dense in $ mathbb {R} $ and disconnected But I'm not sure what arguments and reasoning to show to establish this claim.

As, $ p in mathbb {Q ^ {C}} $ is arbitrary and $ mathbb {Q ^ {C}} $ is infinite, therefore we can infinitely construct many of those pairs.

Can anyone help me on this and show explicitly? I appreciate your help and support in this.

c # – How can I sort a list of integer pairs in sequence?

I have a list of paired integers, each nth integer paired with each nth + 1 integer. I am trying to sort the list so that the pairs form a string. For example:

{3.72, 38.2, 72.5, 2.12}
{38.2, 2.12, 12.72, 72.5}

The trick is that the list can contain multiple unconnected strings. The strings need not be in any sequence, only the pairs within each string.

What I have tried is this (C #):

int a = 0;
int b = 0;
int temp;

while (a < list.Count) {
    b = a + 2;
    while (b < list.Count) {
        if (list(b) == list(a + 1)) {
            temp = list(b);
            list.Insert(a + 2, temp);

            temp = list(b + 1);
            list.RemoveAt(b + 1);
            list.Insert(a + 3, temp);

            a += 2;
            b = a;
        b += 2;
    a += 2;

Which is giving me mostly correct results, but still leaves the list with some disconnected pairs that should be part of a chain.

I am not good with classification algorithms and this has proven to be a difficult problem for google so I hope someone can point out the flaw in my code or point me in the right direction for investigation.

linear algebra: longest possible string in a collection of ordered pairs / coordinates

I have a lot of ordered pairs x, y where 0 <x <y <= n (some have the upper limit)

as S = ((1,2), (1,3), (1,4), (2,3), (3,4))

I need to find the length of the longest subset where all the numbers within the ordered pairs are unique.

Here that would be 2. for example: (1,4) (2,3)

I am writing a code that deals with situations where n is in 100 and S contains thousands of ordered pairs. So going through the possible combinations is too much calculation. I am looking for another approach.

How to select data from the list of pairs since an entry for each element is an element of another list

I have data as follows

data={{6, 23.3}, {6.1, 19.8}, {6.2, 25.1}, {6.3, 25.5}, {6.4, 24.5}, {6.5, 
  28.1}, {6.6, 24.9}, {6.7, 26.3}, {6.8, 27.3}, {6.9, 27.7}, {7, 
  33.9}, {7.1, 26.6}, {7.2, 31.3}, {7.3, 26.8}, {7.4, 31.5}, {7.5, 
  30.2}, {7.6, 29.8}, {7.7, 25.5}, {7.8, 31.5}, {7.9, 28.9}, {8, 

This is a very long list of pairs, which are of the form $ (t, B) $, time and magnitude of the magnetic field. Then I used a code to find relevant points that I need to use. Namely, the peaks of the magnetic field. With the help of FindPeak I discovered that magnetic peak moments are

peaks={{15, 31.5}, {99, 31.6}, {170, 45.7}, {224, 15.7}, {281, 15.6}, {319, 
  13.1}, {345, 10.5}, {349, 11.1}, {437, 8.4}}

I also found the corresponding time using peaktime = data((First /@ peaks, 1))

What I want is to create a list of pairs, in the form $ (t_p, B_p) $ such that $ t_p $ Y $ B_p $ are the peak times and the magnetic field magnitudes, respectively. For this I used a For loop, which is the following:

v = {};
For(i = 1, i <= Length(peaktime), i++, 
 u = Position(data((All, 1)), peaktime((i)))((1)); 
 v = Union(v, u))
peakscouuple = data((v, All));

This works, but it is too messy. Is there a cleaner way to do this?

Modular arithmetic: which pairs of x and y give a multiple of 1000?

I'm playing this cool game called Territory Idle. In this game, two types of buildings can gain resources. Some earn one resource for each worker, while others add one per resource worker.

Here is an example: I have two temples, each with 70 workers. Each worker earns me 1 point of faith plus as many points as there are workers in the cathedral.

territory production of idle faith

I would like to know what combinations of $ x $ (the total number of temple workers) and $ and $ (the number of cathedral workers) equals a profit rate that is a multiple of 1,000. For example, with 140 temple workers, 49 cathedral workers give +7,000 faith per second.

So far I have this: $ x (y + 1) mod 1000 = 0 $

I don't even know if I'm on the right track.

What currency pairs to avoid?

Novice Forex traders should avoid exotic and rare currency pairs as some additional knowledge is needed to trade such pairs successfully.
Here is the list of the main currencies that beginner traders should focus on:
Euro (EUR)
United States dollar (USD)
Pound sterling (GBP)
Swiss franc (CHF)
Japanese Yen (JPY)
Australian dollar (AUD)
Canadian dollar (CAD)
Also, novice Forex traders should try to avoid currency pairs that have high spreads. Spreads vary from broker to broker.

Algorithms: show that if you arbitrarily match the elements of a matrix A of size n to get n / 2 pairs,

then you discard pairs of unequal elements and keep only one of the pairs of matching elements. Then the resulting collection will have a majority if and only if A had a majority, that is, there is an element with more occurrences of floor (n / 2).

I am very confused about how to try this. It is from a DPV textbook problem 2.23. I'm trying to prove it but I end up refuting it.

That is to say. Suppose we have an array of n elements A (), which has a majority of the element x.
that means A.count (x)> floor (n / 2). Now suppose that if we add two different elements, (a, b) to the matrix A, x is no longer the majority. Then: A.count (x) <= floor(n/2) + 1 -> A.count (x) = floor (n / 2) + 1. But now if we apply the same procedure and match (a, b) together, then, by definition, the resulting matrix should have a majority, although the original (. …) or (a, b) did not.

Python: find pairs of numerical palindromes that add another palindrome

I am trying to identify and print pairs of 4-digit palindromes that add up to a 5-digit palindrome.

This is what I have so far

def isPalindrome(x):
    return str(x)==str(x)(::-1)

palindrome = (x for x in range(1000, 9999) if isPalindrome(x))

for x in palindrome:
    for y in palindrome:
        if (9999 < x+y < 100000) and isPalindrome(x+y):
            print(x, y, x+y)

I am estimating the complexity of time for this to be O (n ^ 2), because I am going through the list twice. Is it possible to improve this?

Algorithms: count the number of pairs of elements whose product is a perfect square

Given two matrices whose elements are between $ (1.10 ^ 5) $ and the size of the matrices is $ (1.10 ^ 5) $How can we find the total number of pairs of elements of these matrices so that their product is a perfect square? The matrices can have the same elements.

For example:

Matrix 1: {1, 2, 4, 5}

Matrix 2: {4, 8, 16, 125}

Departure: 6

The pairs are (1, 4), (1, 16), (2, 8), (4, 4), (4, 16), (5, 125).

If the matrix size is $ 10 ^ 5 $, a $ n ^ 2 $ The algorithm would be inefficient.

Is it a good algorithm to find all pairs of strings between 2 sets so that all the words in the first string are contained in the second string?

I have 2 large sets of chains (they are actually product names). "Big" means a few million chains.


Series 1:

Some good product
Another product
Some name

Set 2:

Very long some product name with words blah
Another very long product name
asd asd sad sad asdsa
Blah blah blah

Set 1 contains "good" names. Set 2 contains "dirty" names.

I want: for each element of Set 2 (below: element2) find the longest element of Set 1 (beyond: element1) so that all the words of element1 are contained in element2.

For the given example, the pairs will be the following:

Very long SOME product NAME with words blah => Some name
ANOTHER very long PRODUCT name              => Another product
asd asd sad sad asdsa                       => none
BLAH blah blah                              => blah

Until now I couldn't think of anything better than the brute force algorithm:

  1. Divide each string from Set 1 into words = we get a set of word lists, which is Set 3
  2. Divide each string in Set 2 into words = we get a set of word lists, let it be Set 4
  3. Choose a word list from Set 3 (below: list3), compare it to all the word lists in Set 4 until you find a list that is completely contained in list3.

However, it has a fairly high complexity and works quite slowly. My simple implementation takes about 1.8s to find 1 pair (set 1 has 3 mln elements, set 2 has 4 mln elements). If I implement the same task using MySQL full-text indexes (allows searching for strings that contain all the words given), then 1 search takes about 0.4s. So I wonder if there are some good approaches that could be applied here with small blood 🙂

My programming language is PHP7. The data is stored in MySQL DB.