# Questions tagged [pattern-matching]

For questions about pattern matching in computer science, which is the act of checking a given sequence of tokens for the presence of the constituents of some pattern.

53 questions
Filter by
Sorted by
Tagged with
15 views

19 views

### Probability of corners and the postage stamp patterns is bingo game.

I am very new to this bingo game and want to know how to calculate probability of a particular pattern in bingo game. Here each column has number in range of 1-15, 16-30, 31-45, 46-60 ,and 61-75. ...
36 views

### How can I enumerate the transformation rules on lists of lists?

This is a question about pattern matching and list transformation rules. (I may have the notation a bit wrong). Basically I'm thinking of rules which transform a set of balls with a letter on them, ...
110 views

### How do we find the number of sub-intervals whose intersection with the subset of the entire interval is non-empty?

Suppose we have set $A=\left\{\frac{1}{k}:k\in\mathbb{N}\right\}$ and we divide interval $[0,1]$ into $n$ sub-intervals of equal length. How do we find the exact forumula (or approximation) of the ...
84 views

### Distributing Series/Patterns

I'm going to do my best to explain this question, but it's complicated. Please bear with me. I'm trying to solve a practical problem and I know that the answer involves some math, but I can't for the ...
77 views

### Matchsticks Problem : Finding Maximum Squares Formed by $n$ Sticks

Given $n$ sticks, what is the formula for how many squares that can form with the sticks, where the square's sides each one matchstick? No breaking the matchsticks or allowing them to intersect. ...
124 views

42 views

### Average number of moves to have a specific 3-bit pattern

I would like to know how to have the average number of moves to have a specific 3-bit pattern. It is a random test where the chance of having 0 or 1 is the same: 0.5 (like having a coin toss). We drag ...
30 views

### Matching individual points in two different sets of coordinates

I have to match some 2d sets of points to an another 2d set of points (as ground truth) and find the outliers. In other word I have to match each single point to (maximum) one of the points in the ...
33 views

### Finding the equation pattern of a known set

I have the numbers 1 - 100, when they are put into a box (an abstracted code function I do not know the details of), they come out as ...
67 views

### Ceiling and Floor Formula for Sequence of Numbers

I am trying to find a formula for a sequence of the following numbers: $$4,5,8,9,12,13,16,17,\dots$$ Can anyone help me or give me a hint on how to derive a formula?
43 views

### Formula for sequence of numbers

I am trying to find a somewhat nice general formula for the following sequence. $2,2,6,6,10,10,14,14,\dots$ I found one on wolfram alpha, however I am not sure how to derive it; I am also wondering ...
24 views

### Encryption and Decryption of Alpahabets to Integers

I'll explain my case with an example. Say, I've 2 words, FOOTBALL FOOD Let f(FOOTBALL) = 845614, f(FOOD) = 74312 and f(FO) = 132 Is there any method to get f'(845614, 2) = 132 and f'(...
184 views

### How can I find the sequence of moves which will end the chess-game(only consisting of pawns)? [closed]

The value of (N) for this problem is between [1,100]. There is a chessboard with N rows (numbered 1 through N) and N columns (numbered 1 through N) . Let's denote a cell in row r and column c of the ...
149 views

### Finding a pattern, I'm stuck

I have a friend who knows how much I love math, (I imagine new problems just to do the math behind them and to see if I can expand my understanding) and so he brings me the stuff that stumps him. ...
39 views

### Find the number pattern [closed]

Goal: find 1 equation to generate -4,2,10,6,3 on looping Output -4 on 1st iteration Output 2...
43 views

### Number of possible unique patterns of $5$ points on an $8\times 8$ grid.

I'm after a specific answer and workings/formula for the number of possible unique patterns that $5$ points can have on an $8\times 8$ grid. The pattern must be unique and not match another pattern ...
127 views

### Cross correlation coefficient for 2 matrices (two 2d arrays)

I'm trying to manually calculate cross correlation coefficient for 2 matrices. But I'm not sure how to apply the formula and how it works. Here are my example matrices: Matrix 1 Matrix 2 Any help ...
15 views

### Determining the importance of items across sets?

There's a better term for it. Let's say i have a suite of sets - A, B, C, D. Each set contains any number, in a non-important order, of items - 1,2,3,4,5,6 The items may occur any number (0 or more) ...
45 views

### Split a list of 24 items into four parts, so you need three out of the four parts to recover the entire list

Imagine you have an ordered list of 24 words, and you want to split the list of words into four parts. You want to set it up so that three out of the four parts are needed in order to recover the ...
26 views

### What will be the logic of the answer?

I have this reasoning question (image) So, what I did is I found the number of dots in this, which came out to be: 2 5 11 7 13 19 5 ? 17 And I can't really find what's the pattern in this. ...
531 views

### NON-martingale approach to ABRACADABRA problem

The well-known ABRACADABRA problem states (see D. Williams, "Probability with martingales", for example): a monkey is typing letters A-Z randomly and independently of each other, each letter ...
226 views

### Avoiding exactly one permutation pattern

Let $n \geq k$. We say that a permutation $\sigma \in S_n$ contains a permutation (or "pattern") $\tau \in S_k$ if there is a substring of $k$ (not necessarily consecutive) elements of $\sigma$ ...
65 views

### Getting a specific element of a non-recursive sequence

I have a sequence, starting with $1$. You store the current sequence as a list, then duplicate it. In this copy, you invert it, turning $1$s into $0$s, and $0$s into $1$s. Then, you join it on to the ...
36 views

### Probability of matrix equality under modulo (pattern matching)

Probabilistic pattern matching with matrices works like this: For two given strings, $x,y$ where $x\in\{0,1\}^n$ and $y\in\{0,1\}^m$ and $n\ge m$, we want to find the occurrences of $y$ in $x$. ...
125 views

### Placing letters in three mailboxes

A mailman has 7 letters that are all the same. He can put them in three mailboxes in any order he wants. How many ways are there to put the letters in the mailboxes? Something different about this ...
21 views

### Building an equation (inverse combinatorics?), then identifying the optimal pattern

I have identified an equation, but now I am wanting to know if there is a means of identifying the most efficient pattern to provide the numbers that meet the requirements. Here is the problem: A ...
66 views

### Completing sequence pattern

My kid is class 5 He has got a question of patterns The pattern goes on as 13 15 27 42 ..... and have to find the next number with the rule pattern I am unable to decode, thought question is ...
80 views

### Distance between patterns of points

I was thinking of the following problem: Imagine I am given two lists of points on a 2D plane. These lists have the same size, i.e. both lists have the same number of points. Now, I want to be able ...
107 views

### Special palindromic pattern of $(\frac{10^n-1}{9})^2$

I noticed a repetitive, palindromic pattern when I've performed exponentiation with $10$. That is: $$(\frac{10^n-1}{9})^2 \text{ has a palindromic pattern, }\forall\:n\in [1;9]\:(n\in \mathbb{N})$$ We ...
88 views

### How can I create an equation for a pattern?

How can I generally create an equation from a pattern? Take for example this pattern: {X = 15, Y = 0}, {X = 16, Y = 1}, {X = 16, Y = 2}, {X = 17, Y = 3}, {X = 17, Y = 4} This pattern could be ...
166 views

### Matching the position of points in 2D space

Considering there is a 2-dimensional array $A$ consisting of point coordinates in two dimension space (as shown in image). There is another array 2-dimension array $B$ also representing the position ...
40 views

### Can I Compare Symbol to String

I'm a student majoring in computer science. I'm not sure if I can use the equality sign (=) for a string value. (I can definitely do that in computer code...) So please check the mathematical ...
81 views

### How to explain the difference between the following time series?

I am conducting an empirical study for understanding the behavior of different people in a collaborative environment. There are two types of events in my study: A and B. Let's assume A means ...
177 views

### Is haskell style pattern matching allowed in conventional mathematics and if not, how do you work out the numerator of an arbitrary rational number?

Is it possible to define a function "Numerator" in the following way? $$N(a/b) = a$$ Or likewise is it possible to define a function "Denominator" like this? $$D(a/b) = b$$ These functions take a ...
84 views

### 28 dominoes lying in one direction what is the last one? [duplicate]

Peter with a standard double six set lays 28 dominoes in one direction - what will be the last number on the end on then of the last domino? Suppose he plays in both directions and discovers that he ...
177 views

### Quantify the similarity between two patterns formed by two sets of spatial locations

Suppose I have two sets of spatial locations $X$ and $Y$ on the plane, each with $n$ locations. The coordinates are $X=\{(x_1, y_1), \dots, (x_n, y_n)\}$ and $Y=\{(u_1, v_1), \dots, (u_n, v_n)\}$. I ...
499 views

### How to compute the distance between two vector with different sizes?

I think it's better to start with an example. I have the following vectors: ...
20 views

### Count of matching lines in compared patterns - distribution and significance?

Imagine a number of lines of varying thickness, perpendicular to, and distributed over, a fixed distance, d (in many ways similar to those of a standard barcode). Imagine that one such pattern (lets ...
175 views

### Matching vertices between two graphs

I have a situation where I have two graphs that are supposed to represent the same underlying topology but represent the underlying topology at different resolutions. My goal is to match vertices ...
103 views

### How to find a pattern

I have a list of objects. Each object has $3$ values that will have a value from $0$ to $100$. I want to know how iI be able to find the pattern that is most common in that list. Object 1: 1-2-3 ...
702 views

### Pattern finding algorithms

I am working on a server that will update a list each day. The list will look like the following example. ...
I am reading this paper and am unable to understand this notation in section 2.2 - The right context of a word $u$ according to a language $W$ is the language {$u^{-1}w$ | $w \in W$}. The ...