text:
# Theta palindromes in theta conjugates

A DNA string is a Watson-Crick (WK) palindrome when the complement of its reverse is equal to itself. The Watson-Crick mapping θ is an involution that is also an antimorphism. θ-conjugates of a word is a generalisation of conjugates of a word that incorporates the notion of WK-involution θ. In this paper, we study the distribution of palindromes and Watson-Crick palindromes, also known as θ-palindromes among both the set of conjugates and θ-conjugates of a word w. We also consider some general properties of the set C_θ(w), i.e., the set of θ-conjugates of a word w, and characterize words w such that |C_θ(w)|=|w|+1, i.e., with the maximum number of elements in C_θ(w). We also find the structure of words that have at least one (WK)-palindrome in C_θ(w).

## Authors

• 3 publications
• 3 publications
• 1 publication
• ### Palindromes in two-dimensional Words

A two-dimensional (2D) word is a 2D palindrome if it is equal to its rev...
04/25/2019 ∙ by Kalpana Mahalingam, et al. ∙ 0

• ### String Attractors and Combinatorics on Words

The notion of string attractor has recently been introduced in [Prezza, ...
07/10/2019 ∙ by Sabrina Mantaci, et al. ∙ 0

• ### Comparing reverse complementary genomic words based on their distance distributions and frequencies

In this work we study reverse complementary genomic word pairs in the hu...
10/06/2017 ∙ by Ana Helena Tavares, et al. ∙ 0

• ### Clustering genomic words in human DNA using peaks and trends of distributions

In this work we seek clusters of genomic words in human DNA by studying ...
08/13/2018 ∙ by Ana Helena Tavares, et al. ∙ 0

• ### Learning to Rank Words: Optimizing Ranking Metrics for Word Spotting

In this paper, we explore and evaluate the use of ranking-based objectiv...
06/09/2021 ∙ by Pau Riba, et al. ∙ 0

• ### A Word Communication System with Caregiver Assist for Amyotrophic Lateral Sclerosis Patients in Completely and Almost Completely Locked-in State

People with heavy physical impairment such as amyotrophic lateral sclero...
04/23/2020 ∙ by Kuniaki Ozawa, et al. ∙ 0

• ### Parikh Motivated Study on Repetitions in Words

We introduce the notion of general prints of a word, which is substantia...
07/17/2018 ∙ by Ghajendran Poovanandran, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1. Introduction

The study of sequences have applications in numerous fields such as biology, computer science, mathematics, and physics. DNA molecules, which carry the genetic information in almost all organisms, play an important role in molecular biology (see [3, 5, 6, 13]). DNA computing experiments use information-encoding strings that possess Watson-Crick complementarity property between DNA single-strands which allows information-encoding strands to potentially interact. Formally, the Watson-Crick complementarity property on strings over is an involution with the additional property that for all strings where is an involution, i.e., equals the identity.

The notion of -palindrome was defined in [9] to study palindromes from the perspective of DNA computing. It was defined independently in [4], where closure operators for -palindromes were considered. The classical results on conjugacy and commutativity of words are present in [14]. In [2], the authors study the properties of -primitive words. They prove the existence of a unique -primitive root of a given word, and provided some constraints under which two distinct words share their -primitive root. The combinatorial properties of strings in connection to partial words were investigated in [1]. The notions of conjugacy and commutativity was generalized to incorporate the notion of Watson-Crick complementarity of DNA single-strands in [9]. The authors define and study properties of Watson-Crick conjugate and commutative words, as well as Watson-Crick palindromes. They provide a complete characterization of the set of all words that are not Watson-Crick palindromes. Some properties that link the Watson-Crick palindromes to classical notions such as that of primitive words are established in [10]. The authors show that the set of Watson-Crick-palindromic words that cannot be written as the product of two non-empty Watson-Crick-palindromes equals the set of primitive Watson-Crick-palindromes.

In this paper, we extend the notion of palindromes in conjugacy class of a word to Watson-Crick palindromes and Watson-Crick conjugates of a word. The number of palindromes in the conjugacy class of a word is studied in [7]. We investigate the set of -conjugates of a word. We study the number of Watson-Crick palindromes in a conjugacy class. We then consider the number of palindromes and Watson-Crick palindromes in the Watson-Crick conjugacy set of a given word.

The paper is organised as follows. In Section 3, we study the properties of the set of -conjugates of a word. We first show that for a given word , the maximum number of elements in the -conjugacy of a word is , and we also characterize the words that attain this maximum number. In Section 4, we study the distribution of -palindromes in the conjugacy class of a word. We show that the conjugacy class of a word can contain at most two distinct palindromes. In Section 5, we study the number of palindromes in the set of -conjugates of the word. We find the structure of the words which have at least one palindrome among its -conjugates. Lastly, in Section 5, we analyse the number of -palindromes in the set of -conjugates of a word. We find the structure of the words which have at least one -palindrome among its -conjugates. We end the paper with some concluding remarks.

## 2. Basic definitions and notations

An alphabet is a finite non-empty set of symbols. A word over is defined to be a finite sequence of symbols from . denotes the set of all words over including the empty word and . The length of a word is the number of symbols in a word and is denoted by . The reversal of is defined to be a string where . denotes the set of all sub-words of of length . A word is said to be a palindrome if .

A word is called primitive if implies and . Let denote the set of all primitive words. For every word , there exists a unique word , called the primitive root of , such that and for some . A function is said to be an antimorphism if . The function is called an involution if is an identity on .

A word is said to be a factor of if where . If , then is a prefix of and if , then is a suffix of . A word is a conjugate of if there exists such that . The set of all conjugates of , denoted as , is the conjugacy class of . A word is a -conjugate of another word if for some . The set of all -conjugates of is denoted by . For an antimorphic involution , a finite word is called a -palindrome if . Consider and an antimorphic involution such that and . Then, the word is a -palindrome but not a palindrome. For all other concepts in formal language theory and combinatorics on words, the reader is referred to [8, 11].

Throughout the paper, we take to be an antimorphic involution over .

## 3. Conjugacy and theta-Conjugacy of a word.

In this section, we study the conjugacy class and the -conjugacy set for a word . We show some general properties of the set . We also characterize words for which which is the maximum number of of -conjugates that a word of length can have.

We recall the following result from [9] for -conjugates of a word.

###### Proposition 3.1.

Let be a -conjugate of . Then, for an antimorphic involution , there exists such that either and or .

Thus, we can deduce that for a word ,

 Cθ(w)={θ(v)u : w=uv, u,v∈Σ∗}

Also, Proposition 3.1 implies that the maximum number of elements in is . It is also clear that if is a -palindrome, then the maximum number of elements in is . We illustrate the concept of -conjugacy of a word with the help of an example and show that the number of elements in the -conjugacy of a word may or may not reach the maximum.

###### Example 3.2.

Consider and such that , .

1. If , then and . Note that is a primitive word that is neither a palindrome nor a -palindrome.

2. If , then and . Note that is a primitive word that is neither a palindrome nor a -palindrome.

3. If , then and . Note that is a palindrome.

4. If , then and . Note that is a palindrome.

5. If , then and . Note that is a -palindrome.

6. If , then and . Note that is a -palindrome.

7. If , then and . Note that is not a primitive word but .

It is well known that the maximum number of elements in a conjugacy class of a word is and it is attained if is primitive. This is not true in general for -conjugacy of . It is clear from Example 3.2 that there are primitive words with the maximum number of elements in the set to be less than , equal to and equal to . It is also clear from Example 3.2 that the maximum number of elements in the set , i.e., , can be attained by both primitive as well as a non-primitive word.

We now characterize words with exactly elements in . We first recall some general results from [12].

###### Lemma 3.3.

Let .

• If then, and are powers of a common primitive word.

• If then, for , and ,, , .

We have the following result.

###### Proposition 3.4.

Let . Then, iff is not of the form where , , and are -palindromes.

###### Proof.

Let . We prove that iff where , , and and are -palindromes.
Let , then at least two -conjugates of are equal. Let and be the two -conjugates of that are equal where for . Without loss of generality, let us assume that . Then, , and for some . Now,

 θ(v)u=θ(y)x⟹θ(v)xy1=θ(y1v)x⟹θ(v)xy1=θ(v)θ(y1)x⟹xy1=θ(y1)x.

Then by Lemma 3.3, , where , such that and are -palindromes. Hence, and are -palindromes.
Conversely, let where , , and are -palindromes. Now, and . Consider

 w′′=θ(v)θ(βα)(αβ)iα=θ(v)αβ(αβ)iα=θ(v)(αβ)i+1α=w′.

Therefore, . ∎

The conjugacy operation on words is an equivalence relation. However, the -conjugacy on words is not an equivalence relation. Note that from Example 3.2, it is clear that is a -conjugate of , but is not a -conjugate of . Thus, -conjugacy on words is not a symmetric relation, and hence, not an equivalence relation.

We recall the following from [14].

###### Lemma 3.5.

Let for a primitive word over . Then, the conjugacy class of contains exactly words.

We show that Lemma 3.5 do not hold for -conjugacy. Infact we show that for any word , the number of -conjugates in may not be equal to that of the number of -conjugates in the word . We illustrate with the help of an example.

###### Example 3.6.

Let , and such that . Then,

1. ;

2. ;

We show that the number of -conjugates of a word are greater than the number of -conjugates of a word for and and . We have the following result.

###### Lemma 3.7.

Let . If , then .

###### Proof.

Let such that . Let such that . Now where . Then, . So for each element in , there exist an element in such that is a prefix of . Let . Then . So there exist an element in where . Now if then . Hence, .
Now . Note that the words and have as their prefix. If , we get such that for all . Thus, we get for all , so , i.e., which is a contradiction. Therefore, there exist at least two distinct elements and in whose prefix is . Thus . ∎

We deduce an immediate result.

###### Corollary 3.8.

Let . If , then for .

We recall the following from [10].

###### Proposition 3.9.

If and is an antimorphic involution, then , where and are -palindromes, where .

###### Lemma 3.10.

Let then iff such that for .

###### Proof.

Let , then is a -palindrome. So, is of the form where is a -palindrome. Let where . As , we have, . Then, . Take , then . By Proposition 3.9, we have and where . Then and as is a -palindrome, and . Hence, . Converse is straightforward. ∎

Hence, we deduce the following by Corollary 3.8 and Lemma 3.10.

###### Theorem 3.11.

Let such that for such that , then for .

## 4. Theta palindromes in the conjugacy class of a word

The distribution of palindromes in the conjugacy class of a word was studied in [7]. The authors proved that there are at most two distinct palindromes in the conjugacy class of a given word. In this section, we show an analogous result pertaining to the distribution of -palindromes and prove that the conjugacy class of any given word also contains at most two -palindromes. We also provide the structure of such words. We begin by recalling the following from [7].

###### Lemma 4.1.

If the conjugacy class of a word contains two distinct palindromes, say and , then there exists a word and a number such that is primitive, , and .

In this section, we study the distribution of -palindromes in the conjugacy class of a word.

We first observe the following.

###### Proposition 4.2.

If is a -palindrome, then is a -palindrome for .

We recall the following from [7].

###### Lemma 4.3.

If and for a primitive word then,

is odd and

= for some .

We deduce the following.

###### Lemma 4.4.

Suppose and for a primitive word . Then, is odd and = for some .

###### Proof.

If is even, then . Hence, , contradicting the conditions of the lemma. So is odd and then is even. Let , where . We see that is a prefix of and is a suffix of . Hence, , as required. ∎

###### Lemma 4.5.

If the conjugacy class of a word contains two distinct -palindromes, say and , then there exists a word and a number such that is primitive, , and .

###### Proof.

We use induction on . For , if there are two distinct -palindromes, then they must be of the form and where and , i.e., is primitive. For the inductive step, assume without loss of generality. If , then . By Lemma 4.4, we get for a primitive word and .
Now let . Then is a prefix and suffix of . for . This implies by Lemma 3.3, we obtain , and hence, , for , and . Looking at the central factor of the palindromes

 uv=(θ(s)θ(t))(i+1)θ(s)(st)is
 vu=(st)is(θ(s)θ(t))(i+1)θ(s),

we see that and are also -palindromes. If , then is a -palindrome, implying , which is a contradiction as and are distinct. If , then by Lemma 3.3, both and are powers of some primitive word and by Proposition 4.2, , and are -palindromes, which again implie which is a contradiction. Thus, with and by inductive hypothesis we get , for some primitive word . Then, we have

 (1) v=(xθ(x))jis=s(θ(x)x)ji

Note that, if where , then Eq 1 becomes

 (x1x2θ(x1x2))j(i+1)(xθ(x))kx1=(xθ(x))kx1(θ(x1x2)x1x2)j(i+1)

Then by the comparing suffix, which is a contradiction, since all conjugates of are distinct by Lemma 3.5. The argument for the case when is similar. If , then Eq 1 becomes

 (xθ(x))ji(xθ(x))k=(xθ(x))k(θ(x)x)ji

and by comparing the suffix, we get which is a contradiction as is primitive. Thus, for some . Then we can easily compute , and by using (we know the value of ) to get . Hence, the proof. ∎

We give examples of words that have zero, one and two -palindromes each in their conjugacy class.

###### Example 4.6.

Let , and such that and . Then

1. The word has zero -palindromes in its conjugacy class.

2. The word has exactly one -palindrome in its conjugacy class.

3. The word has two exactly two -palindromes and in its conjugacy class.

We know from Example 4.6 that there exists words that contain exactly, zero, one or two -palindromes in their conjugacy class. However, in the following result, we show that a conjugacy class of any word contains at most two distinct -palindromes and we also find the structure of words that contain exactly two -palindromes in their conjugacy class.

###### Theorem 4.7.

The conjugacy class of a word contains at most two -palindromes. It has exactly two -palindromes iff it contains a word of the form , where is primitive and . Note that such a word has even length.

###### Proof.

It is clear from Example 1 that a word can have upto -palindromes. WLOG, we may assume that is primitive. Suppose there are two -palindromic conjugates of a word , then by Lemma 4.5, they are of the form and where is primitive. We show that the conjugacy class of contains no other -palindromes.

Consider the conjugacy class of . Let and be such that and is a -palindrome. If , say, , then we apply the same argument in Lemma 4.5 and obtain for some and . But this is impossible, because is primitive. Hence, , and . Thus, the conjugacy class contains exactly two -palindromes and the words are of the structure described in Lemma 4.5. ∎

## 5. Palindromes in the set of all Theta-conjugates of a word

The concept of -conjugacy of a word was introduced in [9] to incorporate the notion of Watson-Crick involution map to the conjugacy relation. In this section, we count the number of distinct palindromes in , . We find the structure of words which have at least one palindrome in the set of their -conjugates. We also show that if a word is a palindrome, then there can be at most two palindromes among its -conjugates.

It is clear from Example 3.2, that the words ,  and have zero, one and two palindromes, respectively, in their respective conjugacy classes. We now find the structure of words with at least one palindrome among their conjugates.

###### Theorem 5.1.

Given , contains at least one palindrome iff or where and are palindromes.

###### Proof.

We first show the converse. Let , for a palindrome such that . Then, is a palindrome. Similarly, for where and is a palindrome, is a palindrome. Therefore, when or for palindromes and , contains at least one palindrome. Now, let there exist at least one palindrome in . Let where such that is a palindrome in . Then, we have the following cases:

1. Let and let such that . Now, . Since, is a palindrome and , we get and is a palindrome. Then,

 w=uv=uv1v2=uv1θ(uR).

Since is a palindrome, is a palindrome.

2. If then, , i.e., , and hence, .

3. Let and let such that . Since, we obtain, and a palindrome. Then, .

Hence, in all cases either or where and are palindromes. ∎

It is evident from the definition of -conjugacy of a word that, contains both and . Hence, if is a palindrome, then contains at least two palindromes and . In the following, we show that for a palindrome , and are the only palindromes in the set of all -conjugates of .

###### Theorem 5.2.

For a palindrome , the number of palindromes in is atmost two and is exactly two if .

###### Proof.

Let be a palindrome. Then is also a palindrome. Suppose there exists a where such that is a palindrome, then . We have the following cases.

• If , then there exists a such that . We then have, i.e., . Now, . As is a palindrome, , i.e., . Then, .

• If , then and since is a palindrome, we have, which implies and . Thus, and .

• If , then is a prefix of and is a suffix of since both and are palindromes. If and since is a prefix of and is a suffix of , then with such that and . Thus, , and hence, . If , then for some . Since , and are palindromes, we get

 (2) w=uv=vRαθ(vR)v=vRuR=vRθ(v)αRv;
 (3) θ(w)=θ(v)θ(u)=θ(v)vRθ(α)θ(vR)=θ(uR)θ(vR)=θ(v)θ(αR)vθ(vR).

Equations 2 and 3 gives, and , respectively. Since is a palindrome, and is a palindrome. Now

 θ(w′)=θ(u)v=vRθ(α)θ(vR)v=θ(αR)vθ(vR)v=(θ(w′))R=vRθ(v)θ(αR)v.

Then, we get,

 θ(αR)vθ(vR)=vRθ(v)θ(αR).

Then by Lemma 3.3, , and where , and . Now , i.e., . So and are palindromes and hence,

 θ(w′)=vRθ(α)θ(vR)v=θ(αR)vθ(vR)v=θ(αR)yxv=(xy)ixyxv=x(yx)i+1v.

Then using Equation 2, we get,

 w=uv=vRαθ(vR)v=vRθ(v)αRv=xyx(yx)iv=x(yx)i+1v=θ(w′).

So, .

Hence, in all the cases, we are done. ∎

Consider the word where is a palindrome but not a -palindrome. Then, are palindromes. Moreover the word , where is a palindrome but not a -palindrome, has at least two palindromes. It is evident that there exists a non-palindrome such that contains more than one palindrome.

## 6. Theta palindromes in the Theta-conjugacy set of a word

In this section, for a given word , we study the number of -palindromes in the set . We find the structure of words which have at least one -palindrome in the set of their -conjugates. We also show that if a word is a -palindrome, then there can be at most one -palindrome among its -conjugates.
We first give examples of words that have zero and one -palindrome in their .

###### Example 6.1.

Let , and consider such that and . Then

1. Thus, it has zero -palindromes .

2. The word has exactly one -palindrome .

We now find the structure of words with at least one palindrome among their conjugates.

###### Theorem 6.2.

Given , contains at least one -palindrome iff or where and is a -palindrome.

###### Proof.

Let there exist at least one -palindrome in and let where such that is a -palindrome in . Then, we have the following cases:

1. Let . Let such that . Now, . Since is a -palindrome and , we get and is a -palindrome. Then, and is a -palindrome.

2. Let . Since is a -palindrome and , . Then,

3. Let . Let such that . Now, . Since is a -palindrome and , and is a -palindrome. Then, where is a -palindrome.

Hence, in all the cases either or where and is a -palindrome.
Conversely, let be a -palindrome. If for some then,


text:
## Cryptology ePrint Archive: Report 2020/1079

Subvert KEM to Break DEM: Practical Algorithm-Substitution Attacks on Public-Key Encryption

Rongmao Chen and Xinyi Huang and Moti Yung

Abstract: Motivated by the currently widespread concern about mass surveillance of encrypted communications, Bellare \emph{et al.} introduced at CRYPTO 2014 the notion of Algorithm-Substitution Attack (ASA) where the legitimate encryption algorithm is replaced by a subverted one that aims to undetectably exfiltrate the secret key via ciphertexts. Practically implementable ASAs on various cryptographic primitives (Bellare \emph{et al.}, CRYPTO'14 \& ACM CCS'15; Ateniese \emph{et al.}, ACM CCS'15; Berndt and Liśkiewicz, ACM CCS'17) have been constructed and analyzed, leaking the secret key successfully. Nevertheless, in spite of much progress, the practical impact of ASAs (formulated originally for symmetric key cryptography) on public-key (PKE) encryption operations remains unclear, primarily since the encryption operation of PKE does not involve the secret key, and also previously known ASAs become relatively inefficient for leaking the plaintext due to the logarithmic upper bound of exfiltration rate (Berndt and Liśkiewicz, ACM CCS'17).

In this work, we formulate a practical ASA on PKE encryption algorithm which, perhaps surprisingly, turns out to be much more efficient and robust than existing ones, showing that ASAs on PKE schemes are far more effective and dangerous than previously believed. We mainly target PKE of hybrid encryption which is the most prevalent way to employ PKE in the literature and in practice. The main strategy of our ASA is to subvert the underlying key encapsulation mechanism (KEM) so that the session key encapsulated could be efficiently extracted, which, in turn, breaks the data encapsulation mechanism (DEM) enabling us to learn the plaintext itself. Concretely, our non-black-box yet quite general attack enables recovering the plaintext from only two successive ciphertexts and minimally depends on a short state of previous internal randomness. A widely used class of KEMs is shown to be subvertible by our powerful attack.

Our attack relies on a novel identification and formalization of certain properties that yield practical ASAs on KEMs. More broadly, it points at and may shed some light on exploring structural weaknesses of other composed cryptographic primitives,'' which may make them susceptible to more dangerous ASAs with effectiveness that surpasses the known logarithmic upper bound (i.e., reviewing composition as an attack enabler).

Category / Keywords: public-key cryptography / Algorithm-substitution attacks, public-key encryption, key encapsulation mechanism

Original Publication (with minor differences): IACR-ASIACRYPT-2020

Date: received 7 Sep 2020

Contact author: chromao at nudt edu cn

Available format(s): PDF | BibTeX Citation

Note: A preliminary version of this paper appears at Asiacrypt 2020. This is the full version with more detailed discussions on the countermeasures and ASA on hybrid encryption.

Short URL: ia.cr/2020/1079

[ Cryptology ePrint archive ]

format: plain


text:
# Decompose a value as a sum of square numbers

My daughter had a question on her maths homework which was to write a value as a sum of 4 or fewer square numbers.

For example, x = 73 could be 36 + 36 + 1.

I came up with a really brute force algorithm that shows all combinations but when the values get above 1000 it becomes quite slow.

Is there a clever way of achieving this? Here is my algo in F#

let squares = [ 0.. 100 ] |> Seq.map (fun x -> x * x) |> Seq.toList

let rec calc total attempts squares accu results =
match (total, attempts, squares) with
| (0, _, _) -> accu :: results
| (_, 0, _) -> [] :: results
| (x, _, _) when x < 0 -> [] :: results
| (_, _, []) -> [] :: results
| total, attempts, squares ->
let filteredSquares = squares |> Seq.filter ((>=) total )
filteredSquares
|> Seq.collect(fun sq ->
calc (total - sq)
(attempts - 1)
(filteredSquares |> Seq.toList)
(sq :: accu)
results) |> Seq.toList

let res =
calc 8058 4 squares [] []
|> Seq.filter(fun lst -> lst <> [])
|> Seq.sortBy (fun lst -> lst.Length)
|> Seq.take 1
|> Seq.toList

Additional comments on better F# code would be appreciated as well. One thing I was wondering was whether I could make it lazy using sequences.

• Welcome to Code Review! I've attempted to clarify the problem. If I've misinterpreted it, please correct it. Dec 8 '14 at 11:12
• I'd probably start with something like total - ((int) sq_root(total)) ^ 2 - ie, subtract the largest square available. I'm not sure if this always gets you the fewest number of elements, though. Your big problem is that at every step, you keep trying 1, or other numbers too small for the remaining number of 'attempts'. Dec 8 '14 at 11:18
• Switching from seq.* to array.* will give a pretty significant perf boost. Dec 8 '14 at 11:24

let squares = [ 0.. 100 ] |> Seq.map (fun x -> x * x) |> Seq.toList

I don't think limiting the squares this way is a good idea. Instead, if you moved it inside calc, you could write it as:

let squares =
Seq.initInfinite id
|> Seq.map (fun x -> x * x)
|> Seq.takeWhile (fun x -> x <= total)
|> Seq.toList

calc is a pretty bad name: it doesn't say anything about what the function calculates.

If you limit yourself to returning always only the shortest sum, the signature of the method could be simplified quite a lot: you could get rid of attempts, accu and results. This would also somewhat simplify the implementation.

And even if you don't do that, I think that filtering out empty lists should be done inside calc, not outside.

If you simplify the signature, you could then apply memoization to make the computation much faster. Memoization will help here, because what's slowing down the computation is calculating the result for the same total over and over.

The implementation could look like this:

let rec calculateSquaresSum =
let calculateSquaresSum' total =
if total = 0 then
[]
else
let squares =
Seq.initInfinite (fun x -> x + 1)
|> Seq.map (fun x -> x * x)
|> Seq.takeWhile (fun x -> x <= total)
|> Seq.toList
|> List.rev

squares
|> Seq.map (fun sq -> sq :: (calculateSquaresSum (total - sq)))
|> Seq.minBy (fun sum -> sum.Length)

memoize calculateSquaresSum'

This will calculate the result for values around 10.000 immediately, but 100.000 takes a few seconds, so there likely is a more efficient way to implement this.

Though if you're okay with finding just some decomposition with at most the given length, not necessarily the shortest one, having the attempts parameter makes sense and makes the computation much faster when the decomposition is possible. (E.g. calculateSquaresSum(1000000 - 1, 4) returns immediately with [998001; 1849; 100; 49], while calculateSquaresSum(100000 - 1, 3) takes few seconds to return with a negative answer.)

The code:

let rec calculateSquaresSum =
let calculateSquaresSum' (total, attempts) =
if total = 0 then
Some []
elif attempts = 0 then
None
else
let squares =
Seq.initInfinite (fun x -> x + 1)
|> Seq.map (fun x -> x * x)
|> Seq.takeWhile (fun x -> x <= total)
|> Seq.toList
|> List.rev

squares
|> Seq.map (fun sq ->
match calculateSquaresSum (total - sq, attempts - 1) with
| None -> None
| Some tail -> Some (sq::tail))
|> Seq.tryPick id

memoize calculateSquaresSum'

• Thanks, this works great and is really quick. Thanks also for the really detailed explanation. I also came up with another solution using the sqrt as suggested by @Clockwork-Muse which I have put below. Dec 8 '14 at 19:25
• Actually I deleted the answer because for a number such as 48 it was taking 5 numbers to calculate it and didn't take into account the maximum number of values to use Dec 8 '14 at 19:54


text:
Gravity & geodesics

1. Feb 24, 2006

Thrice

How is the earth on a geodesic? Forgive me if this is basic. I had associated the time dilation effect with acceleration & now it turns out gravity isn't a "force" even though GR in the equivalence principle models it as an acceleration.

To rephrase, the earth is constantly accelerating & yet maximizing its proper time because...

2. Feb 24, 2006

Staff Emeritus
...because the zero-variation-in-action path through the four-dimensional pseudo-Riemannian non-euclidean geometry near a gravitating source is a geodesic in spacetime. Note the involvement of time. Earth's worldline is approximately an "elliptical helix" in spacetime.

3. Feb 24, 2006

Thrice

Ok. So why the equivalence principle then? The theory seems to imply that it's both inertial motion & accelerated motion. I'm guessing that's due to a change of frames?

4. Feb 24, 2006

pervect

Staff Emeritus
Probably your mistake was to associate time dilation with acceleration in the first place. It's hard to be sure because "associated with" is a very vague term.

But if you look at the formula for time dilation due to motion, time dilation is a function of velocity, not by acceleration. (This is a SR effect, which causes the so-called twin paradox).

If you look at the formula for time dilation due to gravity (gravitational red shift, a GR effect), it is a function of potential energy, and (again) not acceleration.

If you want the mathematical details, any time a body follows a path that minimizes or maximizes an intergal, the body must obey certain differential equations called the Euler-Lagrange differential equations.

These are usually taught in physics well before GR, in Lagrangian mechanics. I don't know much about your background, I'm going to assume from your question that you are not familiar with them yet. If I'm right, the following brief treatment will probably bo too rapid, but there's no way to compress a semester physics course into a post.
Anwyay...

One way of writing down the geodesic equations for a body is to write down the intergal for its proper time, which then gives the associated Euler-Lagrange differential equations that describe how it moves. When you do this for the Earth, you find that it orbits the sun, the resulting differential equations are almost exactly the same as the Newtonian differential equations.

For more on the principle of least action and the Euler-Lagrange differential equations, try the wikipedia article

http://en.wikipedia.org/wiki/Action_(physics)

EF taylor's website would probably be another good resource as well:

http://www.eftaylor.com/leastaction.html

Writing down the intergal for proper time is easy. In SR, we simply solve for $d\tau$ given

$$d\tau^2 = dt^2 - dx^2$$

In GR, we add in the metric coefficients

$$d\tau^2 = g_{00} dt^2 + 2 g_{01} dxdt + g_{11} dx^2$$

5. Feb 25, 2006

pmb_phy

The earth is on a geodesic in spacetime (not just space).
How and why?
Gravity is a force. Its called an inertial force. There are two types of forces in nature, inertial forces and non-inertial forces (non-zero 4-force).
You're neglecting to mention the frame of reference in your questions. This is where the problem is. First off the earth has a non-zero spatial acceleration with respect to the rest frame of the sun, but it has zero spatial acceleration in its own (freely-falling) frame. Also, proper time is not always maximized in GR. All that is required is that it has a stationary value.

Pete

6. Mar 18, 2006

Thrice

Could you explain what you mean by stationary value? I'm encountering that a lot.

7. Mar 22, 2006

Blackforest

One of the main and most difficult problem in general relativity is to know how to go from a point A to a point B in the neighborough of A because within this theory there is no long distance homogeneity. The result is that coordinates system for A is not the coordinates system for B and that one have to imagine a stratagem to join both systems in a coherent way.

Concerning the question about the geodesics. The equivalence principle states that the coordinates of B (they are depending on the coordinates of A) must vary in such a way that B has no acceleration if B is not under the influence of any force.

8. Mar 22, 2006

Blackforest

I suppose it means that the ratio : the variation of time for B relatively to the variation of time for A is zero.

9. Mar 23, 2006

pmb_phy

It means that the functional (i.e. integral of a parameter(s)) has a "first derivative" (whatever that means) of zero. Notice the typical idea from calculus y = f(x). y'(x=a) = 0 does not mean that there is a local minumum at x = a but only that the tangent to the curve is parallel to the x=axis. For all the gory details please see

D:\Physics_World\ma\03_geodesic\geodesic.htm

Pete

10. Mar 23, 2006

masudr

This brings up a question I've wanted to ask for a while.

The vacuum metric "moves" so that
$$\int \sqrt{-g}\mathcal{L}\quad d^4x$$
is stationary.

And particles move so that
$$\int d\tau.$$
is stationary.

Does this summarise GR?

11. Mar 23, 2006

pmb_phy

What meaning are you attaching to "metric moves"?

Yes.

Pete

12. Mar 23, 2006

masudr

The components changing with respect to each other is what I mean.

EDIT: I suppose I actually mean its degrees of freedom changing with respect to each other, since component implies we must have a frame, but the metric exists independent of one.

13. Mar 23, 2006

robphy

Of course, you'll have to specify the meanings of the various symbols.
In a variational principle, you have to specify the type of variations under consideration (vary the metric? the connection? something else?)... as well as some boundary conditions. By "moves", you probably mean "is a classical solution to the equations of motion". By "particle", you probably mean "inertial particle".

14. Mar 23, 2006

masudr

Yes that's a good point robphy. The $\mathcal{L}$ should be the Ricci scalar $R$. And the first integral is varied with respect to the metric.

I'm not entirely sure if I do. What difference would that make? Also, could you explain to me what kind of boundary conditions you mean?

Last edited: Mar 23, 2006
15. Mar 23, 2006

pmb_phy

Note - In the present case it is not the metric that is being varied. It is the pathlength which is being varied. The metric merely defines "path length". So there is no variation of the metric here. The components of the metric are functions of position and the position of the "test path" is varied. But one does not say that the metric has changed. Does that clear it up a bit?

Pete

Last edited: Mar 23, 2006
16. Mar 23, 2006

pmb_phy

I see no reason to assume that $\mathcal{L}$ is the Ricci scalar. In those places where there is no matter the Ricci tensor and hence the Ricci scalar are both zero. This would give a zero path length for any variation in empty space (e.g. inbetween planets). And what I just said would hold in all possible spacetimes.

Pete

17. Mar 23, 2006

robphy

For geodesic motion, your particle is travelling inertially (i.e. unaffected by non-gravitational influences).

Concerning boundary conditions: for example,... you might require that your path variations don't change the endpoints.

My point was that one is obligated to specify what is being varied. My reference to the metric and the connection concerned the first problem posed... not the second.

18. Mar 23, 2006

robphy

To say "In those places where there is no matter the Ricci tensor and hence the Ricci scalar are both zero." already uses the the equations of motion, which is what you are trying to find.

Admittedly, the entire problem hasn't been sufficiently well-posed.


text:
Theory Manual Version 3.4
$\newcommand{\lyxlock}{}$
Subsubsection 4.2.2.2: External work of surface forces Up Subsection 4.2.2: Shells with front and back face nodal displacements Subsubsection 4.2.2.4: Shell sandwiched between solid elements

#### 4.2.2.3 Shell on top of solid element

When a shell is coincident with the face of a solid element, we assume that the face of the solid element coincides with the back face () of the shell element. This means that the solid element nodal displacements on that face coincide with the shell nodal displacements . Therefore, when we use UnpackLM for those solid elements, we should reassign the DOF ID's of the displacements to those of the displacements stored in that same node.
Subsubsection 4.2.2.2: External work of surface forces Up Subsection 4.2.2: Shells with front and back face nodal displacements Subsubsection 4.2.2.4: Shell sandwiched between solid elements


text:
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In this post I will give a brief introduction to time series analysis and its applications. We will be using the R package astsa which was developed by professor David Stoffer at the University of Pittsburgh. The textbook it accompanies, which is a good read for anyone interested in the topic, can be found in a free eBook format here: Time Series Analysis and Its Applications

Time series are a series of observations made over a certain time interval. It is commonly used in economic forecasting as well as analyzing climate data over large periods of time. The main idea behind time series analysis is to use a certain number of previous observations to predict future observations.

First we install and load the astsa package.

install.packages("astsa")
require(astsa)

We will be examining the data set gtemp, which contains global temperature deviations from the 1951-1980 average, measured from 1880-2009.

plot(gtemp, xlab="Year", ylab="Deviation", main="Global Temperature Deviations, 1880-2009")

gtemp plot:

Before we build a model, we want to check that the time series is stationary. To be stationary a time series requires three things:

• Constant mean across all t.
• Constant variance across all t.
• Autocovariance between two observations is only dependent on distance between the observations, which we will refer to as the lag h.

Real data usually doesn’t usually meet these standards unless we are measuring something such as white noise. Judging with our eyes, the time series for gtemp appears non-stationary. The mean is non-constant and there is clearly an upward trend. The variance appears to be pretty consistent however.

We can further check this through the acf2() function. If stationary, the ACF/PACF plots will show a quick drop-off in correlation after a small amount of lag between points.

acf2(gtemp)

The dotted blue line details significance threshold for each lag. Clearly this data is non-stationary as a high number of previous observations are correlated with future values. Although regression techniques would allow one to fit a smooth curve to this data, time series analysis is interested in removing as much trend as possible in order to identify potential factors that a regression line wouldn’t capture.

We will now transform the series in to stationary by subtracting Xt-1 from Xt for all values t. This technique is called differencing and can be done with the diff function.

plot(diff(gtemp)
acf2(diff(gtemp))

That seems to have done the trick, with all significant correlation being removed after lag 1. It’s time to fit a time series model to the data using the sarima function. The sarima function takes in 3 parameters (p,d,q), which correspond to the Auto-Regressive order, degree of differencing, and Moving-Average order. If you are not familiar with those terms, I recommend a quick overview here: Auto-regressive-moving-average model

The ACF/PACF plot give us suggestions on what degree of parameters to utilize. If the ACF had a smooth, geometric decay and the PACF a cutoff at lag p, we would utilize a pure AR(p) model. Given that the ACF shows no pattern of a smooth decay and decays to insignificance after lag 1, we will build an MA(1) model to fit the data. We will choose d = 1 as our degree of differencing, evidenced by our earlier call of the diff function.

sarima(diff(gtemp),0,1,1)
Coefficients:
ma1  constant
-0.6550    0.0063
s.e.   0.0795    0.0030
sigma^2 estimated as 0.009574:  log likelihood = 116.11,  aic = -226.22

As we can see from our model, it is a good fit. The residuals fluctuate around 0, and the QQ-plot captures the distribution well besides some length at the extreme tails. We will now forecast our ARIMA model five years in to 2014. The blue lines indicate the standard error of our model.

sarima.for(diff(gtemp),5,0,1,1)

The model forecast fits the data well.

Given a stationary transformation that neutralizes trends such as the one in our original gtemp data, researchers can identify previously unnoticed components to strengthen their forecasting.


text:
# Cube and Cube Roots

In this page we will explain the topics for the chapter 7 of Cube and Cube Roots Class 8 Maths.We have given quality notes and video to explain various things so that students can benefits from it and learn maths in a fun and easy manner, Hope you like them and do not forget to like , social share and comment at the end of the page.

Table of Content

## Hardy - Ramanujan Numbers

Numbers like 1729, 4104, 13832, are known as Hardy – Ramanujan Numbers. They can be
expressed as sum of two cubes in two different ways.
1729 = 1728 + 1 = 123 + 13
1729 = 1000 + 729 = 103 + 93
1729 is the smallest Hardy– Ramanujan Number. There are an infinitely many such numbers. Few are 4104 (2, 16; 9, 15), 13832 (18, 20; 2, 24), Check it with the numbers given in the brackets

## Cube Number

Numbers obtained when a number is multiplied by itself three times are known as cube numbers
Example
1=13
8=23
27=33
Or   if a natural number m can be expressed as n3 where n is also a natural number, then m is a cube number
The numbers 1, 8, 27, 125 ... are cube numbers. These numbers are also called perfect cubes.

## Prime Factorization of Cubes

When we perform the prime factorization of cubes number, we find one special property
8= 2×2×2 (Triplet of prime factor 2)
216 = (2 × 2 × 2) × (3 × 3 × 3)  ( Triplet of 2 and 3)
Each prime factor of a number appears three times in the prime factorization of its cube.

## Smallest multiple that is a perfect cube

Here we find the prime factorization of the number. Then we find the prime factor required to make all of them in triplet.
Example
Find the smallest multiple that will make 392 perfect cube
Solution:
392 = 2 × 2 × 2 × 7 × 7
The prime factor 7 does not appear in a group of three. Therefore, 392 is not a perfect ube. To make its a cube, we need one more 7. In that case
392 × 7 = 2 × 2 × 2 × 7 × 7 × 7 = 2744 which is a perfect cube

## Cube Root

Cube root of a number is the number whose cube is given number
So we know that
27=33
Cube root of 27
$\sqrt[3]{27} =3$

## How to Find Cube root

### Finding cube root through prime factorization

This method, we find the prime factorization of the number.
We will get same prime number occurring in pair for perfect square number. Square root will be given by multiplication of prime factor occurring in pair
Consider
1331
1331= (11×11×11)
$\sqrt[3]{1331} =11$
Example
5832
Solution
5832= (2 × 2 × 2) × (3 × 3× 3) × (3 × 3× 3)
$\sqrt[3]{5832} =2 \times 3 \times 3=18$

### Finding cube root by estimation method

This can be well explained with the example
The given number is 17576.
Step 1 Form groups of three starting from the rightmost digit of 17576.
17 576. In this case one group i.e., 576 has three digits whereas 17 has only two digits.
Step 2 Take 576.
The digit 6 is at its one’s place.
We take the one’s place of the required cube root as 6.
Step 3 Take the other group, i.e., 17.
Cube of 2 is 8 and cube of 3 is 27. 17 lies between 8 and 27.
The smaller number among 2 and 3 is 2.
The one’s place of 2 is 2 itself. Take 2 as ten’s place of the cube root of
17576.
Thus, $\sqrt[3]{17576} =26$
Extra Zing
1) for any Positive integer m, $m^3 > m^2$ i.e cube is greater than square
2) For any negative integer m, $m^3 < m^2$ i.e cube is less than square , as the cube is always negative number and square is positive number
3) Cubes can be written as Addition consecutive odd numbers

$1 = 1 = 1^3$
$3 + 5 = 8 = 2^3$
$7 + 9 + 11 = 27 = 3^3$
$13 + 15 + 17 + 19 = 64 = 4^3$
$21 + 23 + 25 + 27 + 29 = 125 = 5^3$


text:
Tight Bounds on Proper Equivalence Query Learning of DNF.
L. Hellerstein and D. Kletenik and L. Sellie and R. Servedio.
25th Annual Conference on Computational Learning Theory (COLT), JMLR Workshop and Conference Proceedings Vol. 23, 31.1 - 31.18, 2012.

Abstract:

We prove a new structural lemma for partial Boolean functions $f$, which we call the {\em seed lemma for DNF}. Using the lemma, we give the first subexponential algorithm for proper learning of poly$(n)$-term DNF in Angluin's Equivalence Query (EQ) model. The algorithm has time and query complexity $2^{(\tilde{O}{\sqrt{n}})}$, which is optimal. We also give a new result on certificates for DNF-size, a simple algorithm for properly PAC-learning DNF, and new results on EQ-learning $\log n$-term DNF and decision trees.


text:
SBI Clerk 2shift 19 Aug 2007 Question 188

Instructions

In the following questions, the symbols @, #, $, © and % are used with different meanings as follows : ‘P @ Q’ menas ‘P is not smaller than Q, ‘P # menas P is not greater than Q’. ‘P$ 9′ menas P is neither greater than nor equal to Q’.
‘P© Q’ mcnas ‘P is neither smaller than nor equal to Q’.
‘P % menas ‘P is neither greater than nor smaller than Q’.
Now in each of the following questions assuming the given statements to be true, find which of the two conclusions I and II given below them is / are definitely true ?
Give answer a: if only Conclusion I is true.
Give answer b: if only Conclusion II is true.
Give answer c: if either Conclusion I or II is true.
Give answer d: if neither Conclusion I nor II is true.
Give answer e: if both Conclusion I and II are true.

Question 188

Statements :N © J, J % R, R © HConclusions :I : R # NII : N © H

Create a FREE account and get:

• Banking Quant Shortcuts PDF
• Free Banking Study Material - (15000 Questions)
• 135+ Banking previous papers with solutions PDF
• 100+ Online Tests for Free

Comments

OR

Boost your Prep!


text:
### Where is aspnet_regsql.exe

MSDN says

Aspnet_regsql.exe file is located in the
[drive:]\%windir%\Microsoft.NET\Framework\version folder on your Web server

But where exactly is that?

Here's an example of an absolute path of my aspnet_regsql.exe
C:\\Windows\Microsoft.NET\Framework\V2.0\aspnet_regsql.exe

Based on that example, it may be easier for you to determine where exactly your server's aspnet_regsql.exe file is. Be sure to take note of your server's OS (Framework vs Framework64) and its version.


text:
# Raj attempts a typing test of 30 minutes. He starts with a speed of 35 wpm and types for the first ten minutes. Then, his hands start to flail, in the effort to maintain his speed he starts making errors. If in every minute following he makes $$14\frac{2}{7}$$% errors, find his speed at the end of 30 minutes.(approx.)Note: onlynumber of words typed correctly is taken into account.

1. 35
2. 34
3. 33
4. 32
5. 31

Option 4 : 32

## Detailed Solution

Given:
time of typing test = 30 min

Typing speed = 35 words per minute

Percentage errors made in one minute = $$14\frac{2}{7}$$%

Concept:

When an error is made accuracy reduces, hence even if typing speed is maintained speed, in the end, will be reduced due to accuracy issues.

Typing speed at the end of 30 minutes = number of words typed correctly in 30 mins/total time

Calculation:

For the first ten minutes, his accuracy = 100%

Then total correct words by him in the first 10 minutes = 35 words per minute × 10 minutes

⇒ total correct words by him in the first 10 minutes = 350 words

In the next 20 minutes, he makes an error of $$14\frac{2}{7}$$% every minute

Raj’s accuracy reduced by 1/7 every minute, for the next 20 minutes.

⇒ Raj’s new accuracy every minute, for the next 20 minutes = 6/7

Then, total correct words by him in next 20 minutes =  speed × new accuracy × 20 minutes

⇒ Total correct words = 35 words per minute × 6/7 × 20 minutes

⇒ Total correct words = 600 words

Then, total correct words by Raj in 30 minutes = 350 + 600

⇒ Total correct words = 950

His typing speed at the end of 30 minutes = 950/30

⇒ Raj’s typing speed at the end of 30 minutes ≈ 32 words per minute.

∴ The required typing speed = 32 wpm.


text:
# SuSMoST models review¶

SuSMoST can be used for simulation with both abstract and specific models. Abstract models, such as Ising, Langmuir adsorption, hard hexagons, hard disks, k-mers, are usefull for qualitative investigation of properties of wide classes of real-life systems. Specific models are meant be used for investigation of particular systems, for example: adsorption of CO on Pt(111), terephthalic acid on Cu(100), porphyrin on Au(111), 1, 4-cyclohexadiene on Si (001)-2×1, etc. Of course, this stratification is approximate and there are marginal cases that are hard to classify decisively.

SuSMoST is based on a generalized lattice model that is able to describe systems with any crystalline lattice, with arbitrary number of lattice site states and with any pairwise interactions, including long-range and directional ones. SuSMoST uses the following pairwise directional form of the Hamiltonian:

$H = \sum_{i} \mu(\sigma_i) + \sum_{i \neq j} \lambda(\sigma_i, \sigma_j, \vec{\boldsymbol{r}}_{ij})$

Here $$\sigma_i$$ is the state of $$i$$-th lattice site; $$\mu(\sigma)$$ is the adsorption energy of state $$\sigma$$; $$\lambda(\sigma_i, \sigma_j, \vec{\boldsymbol{r}}_{ij})$$ is the lateral interaction energy between $$i$$-th and $$j$$-th lattice sites separated by radius-vector $$\vec{\boldsymbol{r}}_{ij}$$.

Robust mathematical description of the model can be found in paper PhysRevE.93.062804 in Section II - General Model.

In SuSMoST the lattice model description is stored as objects of the class susmost.LatticeTask. These objects can be created with functions susmost.normal_lattice_task() or susmost.load_lattice_task(). The first one is better be used for abstract models, the second one - for specific models, although it is not not required and inverse usages are possible. One should choose the way to create the susmost.LatticeTask object based on convenience of model parameters specification. susmost.load_lattice_task() builds the susmost.LatticeTask object from data provided as a set of files. susmost.normal_lattice_task() builds the susmost.LatticeTask object from other objects created by Python code.

Two ways to create a susmost.LatticeTask object.


text:
# Color Of Code

Cpanel

## C# Detect Processes Demanding user input

User Rating:  / 0

## Problem description

Some time ago, I asked a question on stackoverflow.com. How to programmatically (C#) determine, if ANOTHER external application (native, java, .NET or whatever...) is currently demanding user input? Could this be done fully in Managed code? What would be the implementation of

static Boolean IsDemandingUserInput(String processName)

By demanding user input I mean, when an application asks the user to enter some data or quit an error message (Modal dialogs) and is not able to perform its normal tasks anymore. A drawing application that is waiting for the user to draw something is not meant here. The question seems to interest a lot of people but so far I got no answer that satisfied my needs, despide some great and competent people there.

As the problems I want to solve are more of practical and not theoretical nature, I started to implement a solution. This one at least detects many of the situations inside a running application I want to be informed about.

## Solution (partial)

I worked out a solution that seems to work, please notify me in case of problems with this code so I also gain benefit of improvements. It works for Excel as far as I tested. The only issue I dislike is that I had to use unmanaged calls. It also handles the case when an application is based on a dialog like for MFC, derived from CDialog. Unfortunately I could not find a pure managed solution. Do you have better ideas?

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace Util
{
public class ModalChecker
{
public static Boolean IsWaitingForUserInput(String processName)
{
Process[] processes = Process.GetProcessesByName(processName);
if (processes.Length == 0)
throw new Exception("No process found matching the search criteria");
if (processes.Length > 1)
throw new Exception("More than one process found matching the search criteria");
ModalChecker checker = new ModalChecker(processes[0]);
return checker.WaitingForUserInput;
}

#region Native Windows Stuff
private const int WS_EX_DLGMODALFRAME = 0x00000001;
private const int GWL_EXSTYLE = (-20);
private delegate int EnumWindowsProc(IntPtr hWnd, int lParam);
[DllImport("user32")]
private extern static int EnumWindows(EnumWindowsProc lpEnumFunc, int lParam);
[DllImport("user32", CharSet = CharSet.Auto)]
private extern static uint GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32")]
private extern static uint GetWindowThreadProcessId(IntPtr hWnd, out IntPtr lpdwProcessId);
#endregion

// The process we want the info from
private Process _process;
private Boolean _waiting;

private ModalChecker(Process process)
{
_process = process;
_waiting = false; //default
}

private Boolean WaitingForUserInput
{
get
{
EnumWindows(new EnumWindowsProc(this.WindowEnum), 0);
return _waiting;
}
}

private int WindowEnum(IntPtr hWnd, int lParam)
{
if (hWnd == _process.MainWindowHandle)
return 1;
IntPtr processId;
if (processId.ToInt32() != _process.Id)
return 1;
uint style = GetWindowLong(hWnd, GWL_EXSTYLE);
if ((style & WS_EX_DLGMODALFRAME) != 0)
{
_waiting = true;
return 0; // stop searching further
}
return 1;
}
}
}

## References

• Comments and questions please to me: This email address is being protected from spambots. You need JavaScript enabled to view it.
• The problem as question on Stack Overflow

## Subversion Repository Backup

User Rating:  / 0

## Introduction

The source code is - as the name already tells - the real valuable data for software development. Therefore a proper backup of this important data is absolutely required.

Backups shall provide protection against hardware failures (Hard Disk crash, ...) but ideally also protect against erroneous software (defects in the version control software itself, DB corruption, ...). Usually problems appear slightly resulting in a corrupted DB. The danger of a slowly degrading system is that you might backup an already corrupted DB. So, if you are lucky you will have a full crash and a healthy backup. If your backup got already corrupted as well, on restoration, you will face the same problems as with the original DB.

This article will provide hints on possible backup solutions for subversion repositories to help choosing an appropriate one.

## Subversion

Subversion's repository structure is concentrated in one directory (conf, dav, db, hooks, locks). Each repository holds the bare source, in the db directory. The structure of this db directory varies slightly for subversion from version to version. The data is stored in form of delta files containing the so-called changesets (consistent set of changes across several files). In the versions I looked at, the properties are also stored in separate files. But the db directory also contains extra data, like specific scripts (hook scripts) or the repository configuration (in the conf directory). Beside this, transactional data (valid during a commit for example) is also stored there until the action can be made all at once (atomic commit feature from subversion). The nature of a version control system of beeing additive qualifies it well for incremental backup procedures.

### Backup

For backing up the repositories, you have following options (see the svn book for details regarding on how to perform them):

1. A naive approach using standard backup software (rsync, ...)
4. svnsync (can be done remotely, without file access to the repository being sync'ed)
5. a git svn clone (possible but drawbacks/advantages to be analyzed, feel free to give me feedback)

The solutions differ in:

• (a) if the backup can be done online or if the server has to be stopped during the backup
• the amount of data they back-up (some solutions do not copy all the repository information)
• (b) allowing incremental backups or not. Hotcopy only allows full backups for example.
• (c) Can the hook scripts or the configuration files also be backed up with this method?
• (d) Can the backup be directly used as a read-only fallback solution for the original server. In the case of git-svn the backup can be cloned and used with a git client only.
• (e) restoration time, how quick you can go back to normal work. For transferring the git repository into an svn repository there is quite some work to perform: dump out the repository and load it into subversion. That makes the git-svn approach even slower than the dump solution regarding the time needed to restore the repository.
• (f) independence of the back-end tool or format. This is an advantage to deal with eventual defects in the tool itself. If the repository data is faulty then the data backed-up will also contain the defects. In the case of a text dump the resulting backup is independent from the binary format of a specific subversion version. But this has a cost: the time to restore is high.
• (g) remote: if the backup can be performed remotely (with no direct access to the filesystem holding the repositories). Actually from the presented methods only svnsync and git-svn allow this mode of operation.
 1) naive 2) dump 3) hotcopy 4) sync 5) git-svn a) online - yes yes yes yes b) incremental yes yes - yes yes c1) hook files yes - yes - - c2) config files yes - yes - - d) backup RO yes - yes yes* yes (git) e) restore time File copy Restore (long) File copy File copy* dump -> load f) back-end independence - yes - - yes g) remote - - - yes yes

* Take care of the uuid of the repository it can be changed manually to match the original one in the db directory. In case of mismatching uuids a relocate to the backup repository will not succeed.

Another pitfall is that in the case of svnsync and git-svn, the user performing the backup needs an account with full access to all paths to the source repository. Failing to do that will result into an incomplete backup.

### Restoration

The restoration of a backup is a procedure that is quite time consuming in the case of dump files. These have to be loaded with "svnadmin load". Rebuilding the repository can then take ages depending on the amount of data to restore. Until then you will not be able to work. The hotcopy can be re-used as it is, as well as the self made copy using a standard backup tool. You will need to copy back the files again. The sync solution will need adapting the uuid and replacing the hook files (which you will have to backup manually) but in principle it is also quite easy.

## Recommendation

Considering all these aspects I would recommend using svnsync to create a copy that can be updated incrementally at any time. Take care of copying the hook scripts and config files separately as well as the uuid. (To operate svnsync you will need to allow the pre-revprop-change hook temporarily)

I recommend against the hotcopy unless you have small repositories. In the case of several GB of data, the unability of hotcopy to operate incrementally is a KO criteria (scales badly with the repository size).

Beside this, a regular textual dump with "svnadmin dump" of the repositories is advised for dealing with the scenario where the normal backup is unusable. This is maybe quite paranoid, but it's there as a fallback in this worst case scenario.

User Rating:  / 0

# Debugging inside a generated .NET assembly

.NET assemblies can be generated or compiled from a string directly in memory. This is a great thing as it enables you to make advanced scripting available to your users. They have the full features of C# or any other .NET language and you can bind the generated assembly into your application. This is well known, but there are some difficulties I encountered regarding debugging.

How can one debug the code generated while debugging the generating program? The methods or classes are not known to the application running the script. Using a MethodInvoker lets the code run but you cannot step into it.

## Sample code

-< work in progress >-

See my question on stack overflow.

## Preparation

Some requirements must be met to enable debugging inside such generated assemblies. First of all, the symbols must be available, as well as the source code.

## Calling Break

One possible solution involves the introduction of System.Diagnostics.Debug.Break(); into the script. This works well, the debugger stops at the place where the break was put. But this method is invasive: you have to modify the code of the script to make it work.

## Using interfaces

Another way is to agree about a contract, an interface that both application and script know. One instanciated object that implements the interface can be manipulated by using the interface methods. By stepping into a call to one method, the debugger is able to resolve the source code and display the next line of the generated assembly. You can debug as usual having full debugging capabilities.

## Visual Studio 2010

To my surprise VS 2010 handles the debugging in assemblies generated in memory cleanly. You have the full debugging options.

## Math-JAX

User Rating:  / 0

Great piece of software to typeset mathematical expressions nicely inside the Web: http://www.mathjax.org/

When $a \ne 0$, there are two solutions to $$ax^2 + bx + c = 0$$ and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$


text:
Converts Github path/repo/file information into a link to the raw version of the file

github_raw(file, repo = NULL)

## Arguments

file Name of desired file; if repo is NULL, then this value should also provide repo information, i.e., owner and name of the repository–e.g., "owner/repo/file.ext". Alternatively, user may supply the URL to the file as it appears in a web browser, e.g., "https://github.com/mkearney/driven-snow/blob/master/theme/driven-snow.rstheme" Repository name information formatted as username/repo. If this information is provided in the value supplied to file then leave this as NULL (the default)

## Value

Returns the URL path to the raw version of the file.


text:
# TDO unable to capture MSB of Shifted data in JTAG

With reference to my previously asked question What stage is used to shift out TDO in JTAG? I have another querry.

The JTAG document says that the last bit of data/instruction should be shifted out the same time as Exit1 State is activated. However it also states that TDO is tri-stated in all the states except Shift-IR and Shift-DR states i.e just when Exit1 state is activated, in the following negetive edge of clock, TDO is tri-stated. That means the last bit information sampled on TDI in Exit1 state is lost! How to deal with this situation? I have simulated the RTl for JTAG and sharing the simulation results (waveform snapshot). Please guide.

As seen in waveform, thr IDCODE register is shifted out with value 0xc3631093 and last 2 bits i.e 1 and 1 is shifted out on IDCODE_shift_out at 48.50 us and next 49.50 us respectively.

However TDO only captures the first 1 at 49.0 us and the next 1 is not captured as TDO becomes Z. The test sequence is such that I am shifting out IDCODE on TDO through the state Shift DR -- Exit 1 DR -- Update DR -- Run Test Idle and so on.

Just for reference, these are the different states coded

parameter TEST_LOGIC_RESET=0,
RUN_TEST_IDLE=1,
SELECT_DR=2,
SELECT_IR=3,
CAPTURE_IR=4,
SHIFT_IR=5,
EXIT1_IR=6,
PAUSE_IR=7,
EXIT2_IR=8,
UPDATE_IR=9,
CAPTURE_DR=10,
SHIFT_DR=11,
EXIT1_DR=12,
PAUSE_DR=13,
EXIT2_DR=14,
UPDATE_DR=15;

Edit: Also adding the screenshots for IR selection and IDCODE Shift sequence. Please note, there is no Shift for IR, the sequence for IR is Capture-Exit1 IR-Update IR i.e Just write.

The first screenshot is for IR selection with timestamps

@12.5 us: Sel_IR is high in TAP controller

@14.5 us: Load IR register gets IR value (one cycle delay to capture). Meanwhile, Exit_IR state in TAP Controller.

@15.5 us: Update_IR is high, actual IR register updated(commited) with 0x001001

@16.5 us: Instruction sent to Decoder, decoder outputs 10 resulting in selection of IDCODE register. Sel_DR is high.

@18.5 us: Shift-DR is asserted, and IDCODE data is read into Shift register (Shift_idcode_q).

@19.0 us: Negedge of TCK, TDO gets LSB of shift data

@19.5 us: Data starts right shifting out from Shift register

Coming to waveform 2 screenshot

@49.5 us: MSB of IDCODE is shifted out. State is Exit-1 DR. Shift_DR is de-asserted.

@50.0 us: TDO is again tri-stated.

• Could you please add a screenshot of the full IR selection and shift sequence ?
– Nipo
Aug 7, 2020 at 7:25
• @Nipo I have added the same. Aug 7, 2020 at 7:59
• Thanks. Could you add the selection phase as well ? Just zoom out to have RTI state before and after.
– Nipo
Aug 7, 2020 at 9:55
• You mean IR selection or IDCODE selection phase? I have already shared the IR selection phase. Aug 7, 2020 at 12:58
• <xilinx.com/support/documentation/user_guides/ug380.pdf#page=171> Table 10.4 mentions (points 5,9 and 15) that if instruction is 6 bits, 5 bits are loaded in shift IR state and last bit is loaded in Exit 1 state when TMS = 1. Aug 8, 2020 at 3:50


text:
# Bayes' Ratio: Dramatic Taxicab Example

This is a another short article on Bayesian odds, but in this case the author refers to Bayes' ratio instead. Bayes' theorem is used to derive a formula for the ratio of posterior probabilities $P(A | C) / P(B | C)$ in terms of the prior probabilities $P(A)$, $P(B)$ and the conditional $P(C | A)$ and $P(C | B)$. An application is given to a taxi problem that is similar to the diagnostic testing setting. Unlike other Cut-the-Knot article, this one uses MathJax for the mathematical notation, so the notation is rendered nicely.
Identifier:
http://www.cut-the-knot.org/Probability/RedBlueTaxicabs.shtml
Rating:
Creator(s):
Alexander Bogomolny
Cataloger:
Kyle Siegrist
Publisher:
Cut-the-knot
Rights:
Copyright Alexander Bogomolny. The HTML page can be accessed and linked to, but not copied or used in other works.


text:
# How is $\Delta m^2_{12}$ is identified with the solar mixing angle?

I was reading various reviews on neutrino physics but I couldn't understand the following to complete satisfaction.

How is $\theta_{12}$ identified with the Solar mixing angle and $\Delta m^2_{21}$ the Solar mass-squared difference?

The formulae for three-flavor oscillation probabilities, in general, depends on all three mixing angles $\theta_{12},\theta_{23}$ and $\theta_{13}$:

$$P_{\alpha\rightarrow\beta}=\delta_{\alpha\beta} - 4 \sum_{i>j} {\rm Re}(U_{\alpha i}^{*} U_{\beta i} U_{\alpha j} U_{\beta j}^{*}) \sin^2 \left(\frac{\Delta m_{ij}^2 L}{4E}\right) \\ + 2\sum_{i>j}{\rm Im}(U_{\alpha i}^{*}U_{\beta i}U_{\alpha j} U_{\beta j}^{*}) \sin\left(\frac{\Delta m_{ij}^2 L}{2E}\right).$$

It's not clear to me why only one mixing angle be associated with solar neutrino oscillation. An answer starting from the three-flavour oscillation formulae will be helpful for my understanding.

• – dmckee --- ex-moderator kitten Jun 28 '17 at 16:54
• Too bad there is not official mechanism to combine good answers into a comprehensive one because with all the answers to that very same question, each stressing particularly well a specific aspect of it, we would have the mother of all answers on the subject!!! – user154997 Jul 1 '17 at 19:17

The most important effect in estimating the anticipated production of neutrino types out of the sun is the MSW effect, resonant conversion in matter, and the estimate is a complicated business, but apparently you are not interested in that, in this question.

The point, well made before in @PascExchange 's answer, is sheer numerical accident. Since L, the distance from the sun, is so enormous, the oscillatory factors (see below) in the transition formula in vacuum are dominated by the smallest $\Delta m^2$s: in this case, the 1-2 mass-squared-difference is two orders of magnitude smaller than the other two.

This fortunate accident makes 1-3 and 2-3 oscillation frequencies a hundred times higher, so the corresponding trig functions average out to zero. An intermediate expression reflecting this fact is

Proceed to neglect the very small $\theta_{13}$, and you are there, as only $S_{12}$ survives.

• "Proceed to neglect the very small $\theta_{13}$, and you are there, as only $S_{12}$ survives." Why do you say that? Even when $\theta_{13}$ is neglected, your equations (30)-(40) still contain $\theta_{23}$. – SRS Jul 14 '18 at 13:00
• Adding (39) to (40) in that limit to subtract from 1, yields the persistence probability characteristically depending on $\theta_{12}$, and not $\theta_{23}$, as implied. – Cosmas Zachos Jul 14 '18 at 13:51

In order to answer this question let me go back a bit in the discussion about solar neutrinos. The process, which keeps our sun alive can basically be described as $$p+p\to\ ^2_1\text{H}+e^++\nu_e$$ $$D+p\to\ ^3\text{He}+\gamma$$ The important fact for our current discussion nonetheless is, that during this process we produce electron neutrinos $\nu_e$.

Using the Luminosity, the distance between the sun and the earth and as the energy being released by one single such fusion process we can calculate the expected neutrino flux on earth. Various experiments, covering different Neutrino energies and allowing to detect $\nu_\mu$ and $\nu_e$ now showed, that the there is only half of the expected amount measured. The Sudbury Neutrino Observatory (SNO) now included the capability to measure $\nu_\tau$ by using heavy water instead of normal water, where-after the expected flux was measured. Thus we can conclude that the lack is actually an observation of $\nu_e \to \nu_\mu\to \nu_\tau$ aswell as $\nu_e\to \nu_\tau$ oscillation. To understand why we still claim that we get one squared mass difference out of that can be understood when consulting the particle physics booklet. Here we find the following values for the squared mass differences between the two generations $\Delta m_{12}^2=(7.53\pm 0.18)\cdot 10^{-5}$ and $\Delta m_{23}^2=(2.52\pm 0.05)\cdot 10^{-3}$. We realize that the difference $\Delta m_{12}$ is quite small compared to $\Delta m_{23}$ and therefore we can only distinguish between the first two, respectively the second and third generation and therefore we can only regard the $\mu_e\to \mu_\tau$ part.


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 21 Aug 2018, 06:52

GMAT Club Daily Prep

Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

If a and b are integers, is a + b + 3 an odd integer?

Author Message
TAGS:

Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 48096
If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

26 Jun 2017, 02:51
00:00

Difficulty:

15% (low)

Question Stats:

74% (00:55) correct 26% (00:55) wrong based on 618 sessions

HideShow timer Statistics

If a and b are integers, is a + b + 3 an odd integer?

(1) ab is an odd integer.
(2) a − b is an even integer.

_________________
Director
Joined: 04 Dec 2015
Posts: 700
Location: India
Concentration: Technology, Strategy
Schools: ISB '19, IIMA , IIMB, XLRI
WE: Information Technology (Consulting)
If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

26 Jun 2017, 03:20
3
Bunuel wrote:
If a and b are integers, is a + b + 3 an odd integer?

(1) ab is an odd integer.
(2) a − b is an even integer.

(1) $$ab$$ is an odd integer.

$$Odd * Odd = Odd$$

Therefore $$a$$ and $$b$$ should be Odd integers.

($$Odd + Odd = Even$$ ) and ($$Even + Odd = Odd$$)

$$a + b = Even$$

$$a + b + 3 = Even + 3$$ = Odd integer.

Hence I is Sufficient.

(2) $$a − b$$ is an even integer.

$$Odd - Odd = Even$$

$$Even - Even = Even.$$

Therefore $$a$$ and $$b$$ could both either be Even or both be Odd.

If $$a$$ and $$b$$ are Odd. ($$Odd + Odd = Even$$) and ($$Even + Odd = Odd$$)

$$a + b + 3 = Odd + Odd + 3 = Even + 3 = Odd$$ --------- True.

If $$a$$ and $$b$$ are Even. ($$Even + Even = Even$$) and ($$Even + Odd = Odd$$)

$$a + b + 3 = Even + Even + 3 = Even + 3 = Odd$$ ------- True.

Hence II is Sufficient. Answer (D)...
BSchool Forum Moderator
Joined: 26 Feb 2016
Posts: 3059
Location: India
GPA: 3.12
If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

26 Jun 2017, 03:23
Given : a and b are integers
We need to find out if a + b + 3 is an odd integer

(1) ab is an odd integer.
This is possible only when both a and b are odd.
Hence sum of a and b will be even, making the sum(a + b + 3) an odd integer(Sufficient)
(2) a − b is an even integer.
This is possible when both a and b is even or odd.
In either case, the sum of a and b is even.
Thus, a+b+3 is odd(Sufficient) (Option D)
_________________

You've got what it takes, but it will take everything you've got

Retired Moderator
Joined: 19 Mar 2014
Posts: 969
Location: India
Concentration: Finance, Entrepreneurship
GPA: 3.5
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

26 Jun 2017, 03:32
If a and b are integers, is $$a + b + 3$$ an odd integer?

In order to find $$a + b + 3$$ is ODD, we need to find.

ODD + ODD + 3 = ODD

EVEN + EVEN + 3 = ODD

Which means, if we are able to confirm if a & b both are ODD or if a & b both are EVEN we should be able to answer the question.

(1) ab is an odd integer

ab = ODD

This means that a & b both are ODD

As per above this information should be sufficient to prove $$a + b + 3$$ is ODD as ODD + ODD + 3 = ODD

Hence, Eq. (1) =====> is SUFFICIENT

(2) a − b is an even integer

a - b is EVEN

This is only possible if

a & b are both ODD

a & b are both EVEN

As this is sufficient to answer the question $$a + b + 3$$ is ODD

Hence, Eq. (2) =====> is SUFFICIENT

_________________

"Nothing in this world can take the place of persistence. Talent will not: nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not: the world is full of educated derelicts. Persistence and determination alone are omnipotent."

Best AWA Template: https://gmatclub.com/forum/how-to-get-6-0-awa-my-guide-64327.html#p470475

DS Forum Moderator
Joined: 22 Aug 2013
Posts: 1343
Location: India
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

03 Jul 2017, 01:27
1
Given that a and b are both integers, so each of them must be either even or odd. a+b+3 will be odd when (a+b) is even.

Statement 1. product of a & b is odd, which is only possible when both a & b are odd. And if both a & b are odd, then (a+b) is even. So we know. Sufficient.

Statement 2. a-b is even, this will happen either when
both a & b are even, in which case (a+b) will also be even
or when both a & b are odd, in which case too (a+b) will be even.

a+b is even in any case, so we know. Sufficient.

Each statement alone is sufficient. Hence D answer
Manager
Joined: 30 Apr 2016
Posts: 61
Location: India
GMAT 1: 720 Q50 V38
GPA: 4
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

03 Jul 2017, 23:49
1
Bunuel wrote:
If a and b are integers, is a + b + 3 an odd integer?

(1) ab is an odd integer.
(2) a − b is an even integer.

for a+b+3 to be odd a+b should be even

1) if ab is an odd integer then a and b are individually odd, so a+b= odd+odd=Even : sufficient .
2)a- b is an even integer, so a and b are both even or both odd. In either cases the sum a+b is even : sufficient.
Target Test Prep Representative
Status: Founder & CEO
Affiliations: Target Test Prep
Joined: 14 Oct 2015
Posts: 3186
Location: United States (CA)
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

17 Nov 2017, 12:31
Bunuel wrote:
If a and b are integers, is a + b + 3 an odd integer?

(1) ab is an odd integer.
(2) a − b is an even integer.

We need to determine whether a + b + 3 is odd, or in other words, whether a + b is even.

Statement One Alone:

ab is an odd integer.

Because ab is odd, we know that a and b must both be odd, and since odd + odd = even, a + b is even. Statement one alone is sufficient to answer the question.

Statement Two Alone:

a - b is an even integer.

Since a - b is even, a + b is also even. Statement two alone is sufficient.

_________________

Scott Woodbury-Stewart
Founder and CEO

GMAT Quant Self-Study Course
500+ lessons 3000+ practice problems 800+ HD solutions

Intern
Joined: 10 Dec 2017
Posts: 2
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

10 Jan 2018, 12:37
While I am clear on the even and odd concept ,for this question given that they are integers- do we ignore about them being positive or negative integers?
Math Expert
Joined: 02 Sep 2009
Posts: 48096
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

10 Jan 2018, 13:28
deeptijp wrote:
While I am clear on the even and odd concept ,for this question given that they are integers- do we ignore about them being positive or negative integers?

a and b could be negative even/odd integers but this does not change the answer. Is it what you were asking?
_________________
Intern
Joined: 10 Dec 2017
Posts: 2
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

10 Jan 2018, 14:32
Bunuel wrote:
deeptijp wrote:
While I am clear on the even and odd concept ,for this question given that they are integers- do we ignore about them being positive or negative integers?

a and b could be negative even/odd integers but this does not change the answer. Is it what you were asking?

yes,as I was a bit doubtful when solving the question that when do we consider the signs as no one posted solution considering signs.
Study Buddy Forum Moderator
Joined: 04 Sep 2016
Posts: 1169
Location: India
WE: Engineering (Other)
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

23 Jan 2018, 18:56
amanvermagmat niks18

Quote:
Given that a and b are both integers, so each of them must be either even or odd. a+b+3 will be odd when (a+b) is even.

Statement 1. product of a & b is odd, which is only possible when both a & b are odd. And if both a & b are odd, then (a+b) is even. So we know. Sufficient.

Statement 2. a-b is even, this will happen either when
both a & b are even, in which case (a+b) will also be even
or when both a & b are odd, in which case too (a+b) will be even.

a+b is even in any case, so we know. Sufficient.

Each statement alone is sufficient. Hence D answer

I landed with same ans using identical approach of dissecting Q stem before moving to ans choices.
I just took few additional secs for checking for St 2 by taking random nos. Did you carry above step mentally?
_________________

It's the journey that brings us happiness not the destination.

PS Forum Moderator
Joined: 25 Feb 2013
Posts: 1208
Location: India
GPA: 3.82
Re: If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

23 Jan 2018, 19:40
amanvermagmat niks18

Quote:
Given that a and b are both integers, so each of them must be either even or odd. a+b+3 will be odd when (a+b) is even.

Statement 1. product of a & b is odd, which is only possible when both a & b are odd. And if both a & b are odd, then (a+b) is even. So we know. Sufficient.

Statement 2. a-b is even, this will happen either when
both a & b are even, in which case (a+b) will also be even
or when both a & b are odd, in which case too (a+b) will be even.

a+b is even in any case, so we know. Sufficient.

Each statement alone is sufficient. Hence D answer

I landed with same ans using identical approach of dissecting Q stem before moving to ans choices.
I just took few additional secs for checking for St 2 by taking random nos. Did you carry above step mentally?

On adding or subtracting two integers, the nature of resulting value will not change I.e if on subtracting two integers the resulting value is Even then on adding the same numbers the resulting value will be Even. If you thought about this then the question is very simple and you might not need to test values.
So if a=5 and b=3, then a-b=2 and a+b=8 both are Even

Similarly if both are Even then result will obviously be Even

Posted from my mobile device
DS Forum Moderator
Joined: 22 Aug 2013
Posts: 1343
Location: India
If a and b are integers, is a + b + 3 an odd integer?  [#permalink]

Show Tags

23 Jan 2018, 22:38
amanvermagmat niks18

Quote:
Given that a and b are both integers, so each of them must be either even or odd. a+b+3 will be odd when (a+b) is even.

Statement 1. product of a & b is odd, which is only possible when both a & b are odd. And if both a & b are odd, then (a+b) is even. So we know. Sufficient.

Statement 2. a-b is even, this will happen either when
both a & b are even, in which case (a+b) will also be even
or when both a & b are odd, in which case too (a+b) will be even.

a+b is even in any case, so we know. Sufficient.

Each statement alone is sufficient. Hence D answer

I landed with same ans using identical approach of dissecting Q stem before moving to ans choices.
I just took few additional secs for checking for St 2 by taking random nos. Did you carry above step mentally?

Hi

Yes, now I dont need to do any calculation mentally regarding even/odd in these kind of questions - because the basic rules regarding addition/subtraction/multiplication of even/odd are drilled in my head.
I suggest that you too look at these rules again (from number theory) here (in case you think you need to improve on this):

https://gmatclub.com/forum/math-number- ... 88376.html

And then practice with as many values as you can, till it becomes easy and natural to you. Good luck!
If a and b are integers, is a + b + 3 an odd integer? &nbs [#permalink] 23 Jan 2018, 22:38
Display posts from previous: Sort by

Events & Promotions

 Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.


text:
# Math Help - Calculus Circle Word Problem

1. ## Calculus Circle Word Problem

These word problems are driving me crazy.....

Clyde and CeCe are running around a circular track of radius 50 meters in the same direction. Clyde is running at a rate of 1.3 m/sec and CeCe is running at a rate of 0.9 m/sec. When Clyde is behind CeCe as pictured and the (straight) distance between them is 82 meters, how is the (straight) distance between them changing?

2. Let's try using the formula for a chord and the formula $s=r{\theta}$

chord length is given by $L=2rsin(\frac{\theta}{2})$

Arc length is given by $s=r{\theta}$

Clyde is catching up to CeCe, so their distance along the arc is decreasing at -0.4 m/sec.

That is ds/dt = -.4.

$\frac{ds}{dt}=r\frac{d{\theta}}{dt}+{\theta}\frac{ dr}{dt}$

$-.4=50\frac{d{\theta}}{dt}+0$. dr/dt is 0 because the radius does not change.

$\frac{d{\theta}}{dt} = -.008$

When they are 82 feet apart along the chord, then using $2rsin(\frac{\theta}{2})$

${\theta}=2sin^{-1}(\frac{82}{100})=1.92282 \;\ rad.$

So, let's differentiate implicitly our chord formula.

$\frac{dL}{dt}=50cos(\frac{\theta}{2})\frac{d{\thet a}}{dt}$

$\frac{dL}{dt}=50cos(\frac{1.92282}{2})(-.008)=-.229$

The distance between them is decreasing at .229 m/sec.

Let's see if anyone concurs. Check my work.


text:
How do you divide 1/(-2i)?

Jul 21, 2016

$\frac{i}{2}$

Explanation:

Remember that we can multiply the top and bottom of a fraction by the same amount without changing the value. We use the complex conjugate in this case:

$\frac{1}{- 2 i} \cdot \frac{2 i}{2 i}$

$\frac{2 i}{- 4 {i}^{2}}$

Recall that ${i}^{2} = - 1$

$\frac{2 i}{- 4 \left(- 1\right)} = \frac{2 i}{4} = \frac{i}{2}$