text: MEMORY METER. We use cookies to improve your experience on our site and to show you relevant advertising. A frequency is a count of the occurrences of values within a data-set. Step 4. where, \begin{aligned} \text{Mode } &= l + \bigg(\frac{f_m - f_1}{2f_m-f_1-f_2}\bigg)\times h\\ &= 18.5 + \bigg(\frac{24 - 15}{2\times24 - 15 - 2}\bigg)\times 3\\ &= 18.5 + \bigg(\frac{9}{31}\bigg)\times 3\\ &= 18.5 + \big(0.2903\big)\times 3\\ &= 18.5 + \big(0.871\big)\\ &= 19.371 \text{ minutes} \end{aligned}. This grouped data you can enter: 10-20 20-30 30-40 f: 5 10 15 How to enter data as a cumulative frequency table? Mode : If a set of individual observations are given, then the mode is the value which occurs most often. Enter your population or sample observed values in the box below. Step 2. Mean The average of all the data in a set. Step 1 - Select type of frequency distribution (Discrete or continuous) Step 2 - Enter the Range or classes (X) seperated by comma (,) So the mean of the data would be (8+9+6+12+19)/2 = 54/2 = 27. The median is the central number of a data set. Find the average mean for the group data. Finding weighted mean by hand or using the TI calculator % Progress . Also, you may be interested in using this percentile calculator for grouped data, which uses the interpolation formula. Visit https://StudyForce.com/index.php?board=33.0 to start asking questions. \begin{aligned} \text{Median} &=\bigg(\dfrac{N}{2}\bigg)^{th}\text{ value}\\ &= \bigg(\dfrac{56}{2}\bigg)^{th}\text{ value}\\ &=\big(28\big)^{th}\text{ value} \end{aligned} Arithmetic mean Can be used for calculating statistics for grouped numbers. Learn more about the advantages and disadvantages of each of these statistical values and when each should be used, or explore hundreds of other calculators addressing math, finance, health, fitness, and more. Let us see the methods of calculating Mean of grouped data. Mid-Interval Values When mid-interval values are used to represent all scores within that interval, what effect will this have on estimating the mean of the grouped data? © VrcAcademy - 2020About Us | Our Team | Privacy Policy | Terms of Use. These are the most popular summarizing statistics used to describe a data set using one or several numbers. Mode of the given frequency distribution is: How To Find the Mean of Ungrouped Data. A frequency is a count of the occurrences of values within a data-set. b) Write down the modal class for the data. For example, consider you have the following data set: 8,9,6,12,19. Similar as frequency table, but instead f: type cf: in second line. Examples of Median of Grouped Data: With relation to a continuous group of data, a median is an important value which represents the middle value of a group of data. So the ECDF jumps from 0 to .1 (10%) at 12000. It is also known as the mean absolute deviation, abbreviated as MAD. The corresponding class $15.5-18.5$ is the median class. This indicates how strong in your memory this concept is. Median is defined as the middle value of the data when the data is arranged in ascending or descending order. Hope you like Mean Mode Median for grouped data calculator. Find the number of observations in the given set of data. L is the lower class boundary of the group containing the median 2. n is the total number of data 3. To find the arithmetic mean we sum all the values in the series divided by the total numbers of values in the series. Practice. To find the value of mean, divide this sum by the total number of observations in the data. Use Mean median mode for grouped data calculator to find the mean, median and mode for grouped (frequency distribution) data. This website uses cookies to ensure you get the best experience on our site and to provide a comment feature. The mean, median and mode can all be called an "average" in certain literature, but using their proper technical names is recommended to avoid confusion. Ungrouped Data to Find the Mean. Please type those classes and frequencies in the form below: It is not uncommon to have grouped data, as opposed to having raw data. Harmonic mean is an important measure of central tendency of the data.It is used for calculating average of ratios.Harmonic mean calculator for grouped data Notes: (i) A percentile is a value in the data set. B is the cumulative frequency of the groups before the median group 4. step 3: find the grouped data mean μ μ = (55 x 9 + 65.5 x 7 + 78 x 9 + 90.5 x 12 + 98 x 8 )/n = 3525.5/45 μ = 78.3444 step 4: find the variance σ 2 = (((9 x 552) + (7 x 65.52) + (9 x 782) + (12 x 90.52) + (8 x 982)) - (45 x 78.3444 2))/(45 - 1) = (287127.75 - 276203.025)/ 44 σ 2 = 248.2820 step 5: find standard deviation for the grouped data When we say raw data, we mean individual data. Grouped Data Grouped data are the data or scores that are arranged in a frequency distribution. Grouped Data Calculation. The cumulative frequency just greater than or equal to $28$ is $30$. The maximum frequency is $24$, the corresponding class $18.5-21.5$ is the modal class. So the mean of the data would be (8+9+6+12+19)/2 = 54/2 = 27. Sample Variance of Grouped Data Calculator, Degrees of Freedom Calculator Paired Samples, Degrees of Freedom Calculator Two Samples. This website uses cookies to improve your experience. Progress % Practice Now. In case of continuous frequency distribution, $x_i$'s are the Compute five number summary for the following frequency distribution. Let's practice finding mean of grouped data. Harmonic mean is used to calculate the average of a set of numbers. Instructions: Use this Sample Mean of Grouped Data Calculator to find the sample mean when you have grouped data, in the form of classes and associated frequencies. For grouped data, we cannot find the exact Mean, Median and Mode, we can only give estimates. Mean absolute deviation (MAD) Range; Interquartile range; First and second Quartiles (Q 1 and Q 3) Specify whether the data is for an entire population or from a sample. The median of given frequency distribution can be computed as follows: \begin{aligned} \text{Median } &= l + \bigg(\frac{\frac{N}{2} - F_<}{f}\bigg)\times h\\ &= 15.5 + \bigg(\frac{\frac{56}{2} - 15}{15}\bigg)\times 3\\ &= 15.5 + \bigg(\frac{28 - 15}{15}\bigg)\times 3\\ &= 15.5 + \big(0.8667\big)\times 3\\ &= 15.5 + 2.6\\ &= 18.1 \text{ minutes} \end{aligned}. \begin{aligned} \text{Mode } &= l + \bigg(\frac{f_m - f_1}{2f_m-f_1-f_2}\bigg)\times h\\ \end{aligned} This is not really grouped, as each row pertains to a single value – except for the last, which is a group representing all higher numbers! Solution: X is the midpoint of the class. Values must be numeric and separated by commas, spaces or new-line. c) Estimate the mean of the data. Find mean median and mode of grouped data : Here we are going to see how to find mean median and mode of grouped data. Lecture 2 – Grouped Data Calculation (\overline{x})\) = $$\frac{1}{N}\sum\limits_{i=1}^{n}f_i|x_i – \overline{x}|$$ The … Practice. A frequency distribution table is created, which shows the frequencies of the given data set. Examples of Median of Grouped Data: With relation to a continuous group of data, a median is an important value which represents the middle value of a group of data. Grouped Data Arithmetic Mean Calculator. Calculate the mean. For example, if a value is located at the 80th percentile, it means that 80% of the values that fall below the value and 20% of the values fall above it. If n is odd, the median equals the [(n+1)/2] th observation. The classes are inclusive. Mean, median, mode, and range. To find the MEAN (or “Mathematically Estimated Average Number”), involves adding two extra columns to our original Frequency Table. Two of our most-viewed posts deal with Mode and Median of Grouped Data: how to calculate these statistics for data that is supplied in the form of frequencies for classes of data (bins), rather than the individual data values.Here we’ll complete that topic with a look at the less troublesome cases of Mean and Standard Deviation, including some issues that arise in the grouping process itself. 2. Frequency table calculator A frequency is the number of times a data value occurs. 2. Worked Examples. If you're seeing this message, it means we're having trouble loading external resources on our website. Finding weighted mean by hand or using the TI calculator % Progress . Step 1 - Select type of frequency distribution (Discrete or continuous), Step 2 - Enter the Range or classes (X) seperated by comma (,), Step 3 - Enter the Frequencies (f) seperated by comma, Step 4 - Click on “Calculate” for mean,mode and median Calculator for grouped data, Step 5 - Gives output as number of observation (n), Step 6 - Calculate mean of frequency distribution, Step 7 - Calculate mode of frequency distribution, Step 8 - Calculate median of frequency distribution, Let $x_1, x_2, \cdots , x_n$ have frequencies $f_1, f_2, \cdots ,f_n$ respectively, then the Harmonic Mean is given by, $$\begin{equation*} Mean =\overline{X} = \frac{1}{N}\sum_{i=1}^{n}f_ix_i\quad \mbox{ where }N = \sum_{i=1}^{n} f_i \end{equation*}$$. Q1. So then, having raw data means having all the information of the sample. Instructions: This calculator of descriptive statistics for grouped data calculates the sample mean, variance and standard deviation for grouped data. The word mean, which is a homonym for multiple other words in the English language, is similarly ambiguous even in the area of mathematics. Hint - the data above is an example of grouped data. The sum of these products gives an approximation for the sum of all values. The mean is the same as the average value of a data set and is found using a calculation. Grouped Data Arithmetic Mean Example:. Find the average mean for the group data. It is used to describe a set of data where the measures cluster or concentrate at a point. Click on Theory button to read more about mean median,sample for grouped data and step by step examples explained. For a more complete analysis of descriptive statistics of grouped data use this calculator. Learn more How to find median for grouped data ? Can be used for calculating statistics for grouped numbers or creating new math problems. Free grouped data arithmetic mean calculations online. For ungrouped data: Step 1. The formula to find the harmonic mean is given by: For Ungrouped Data: If n is odd, the median equals the [(n+1)/2] th observation. In case you have any suggestion, or if you would like to report a broken solver/calculator, please do not hesitate to contact us. ADVERTISEMENTS: In this article we will discuss about the calculation of simple and weighted arithmetic mean with the help of formulas. These are the most popular summarizing statistics used to describe a data set using one or several numbers. ... Let me know in the comments if you have any questions on Mean absolute deviation calculator for grouped data with examples and your thought on this article. Mean The mean (also known as the arithmetic mean) is the most commonly used measure of central position. Then, we have to use the following formula: \text {Sample Mean of Grouped Data} = \frac {1} {N}\sum\limits_ {i=1}^ {k} { { {M}_ {i}}\cdot { {f}_ {i}}} Sample Mean of Grouped Data = N 1 This calculator will calculate the mean, median, mode, minimum, maximum, and range of a data set. To estimate the Mean use the midpoints of the class intervals: Estimated Mean = Sum of (Midpoint × Frequency)Sum of Freqency 3. This indicates how strong in your memory this concept is. For example, if ten students score 90 in statistics, then score 90 has a frequency of 10. For grouped data: Step 1. Example 1 : Find the median for marks of 50 students. MEMORY METER. Brought to you by: https://StudyForce.com Still stuck in math? Find Mean, Median and Mode for grouped data calculator - Find Mean, Median and Mode for grouped data, step-by-step. The median of frequency distribution is given by, The mode of the frequency distribution is given by. The mean of $X$ is denoted by $\overline{x}$ and is given by. Ungrouped Data to Find the Mean. If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked. Functions: What They Are and How to Deal with Them, Normal Probability Calculator for Sampling Distributions, sample variance calculator for grouped data. Since we are given grouped data rather than the original ungrouped data, the best we can do is approximate the mean as if all the learners in each interval were located at … Mean, Median and Mode 2. The formula for calculation for mean is slightly different from grouped data. (a) Estimate the mean height. It is adding the class limits and divide by 2. Math is Fun: Mean, Median and Mode from Grouped Frequencies, which I referred to last time; this says, under Estimating the Median from Grouped Data, Estimated Median = $$L + \frac{(n/2) − B}{G} × w$$ where: L is the lower class boundary of the group containing the median; n … Concept of mean deviation of grouped data by using mean This video is about: Calculation of Mean Deviation from Group Data according to Mean. Hence to calculate the Arithmetic Mean of any data, you need to divide the sum of observations by the number of observations. In the below calculator, input the statistically grouped data (continuous/discrete frequency distribution) and the frequencies separated by comma, the Mean Deviation about Median for Grouped Data calculator will update you with the median value and the mean deviation (MAD) value. It is obtained by simply adding all the values and dividing them by the number of items. Mode The value which occures most frequently in a data set. Harmonic mean is an important measure of central tendency of the data.It is used for calculating average of ratios.Harmonic mean calculator for grouped data Grouped Data Arithmetic Mean Formula : Arithmetic Mean = ΣfX/Σf. The mean, median and mode can all be called an "average" in certain literature, but using their proper technical names is recommended to avoid confusion. Mean, median, mode, and range. d) Calculate the percentage of days on which the temperature was at least 28°C. Here, we will be studying methods to calculate range and mean deviation for grouped data. Progress % Practice Now. For example, if ten students score 90 in statistics, then score 90 has a frequency of 10. First Quantile, third Quantile and Interquantile Range. N is the total number of observations in the data. To find the arithmetic mean we sum all the values in the series divided by the total numbers of values in the series. It comes with ranges of values associated with a frequency. Finding the MEAN involves more working out than finding the Modal Class and Median Class. Apparently the author of this problem says that we can’t find the mean, because of the open-ended class. Grouped Data to Find the Mean. Arithmetic mean … Grouped data is specified in class groups instead of individual values. Grouped Data Arithmetic Mean Calculator. How to calculate mean values grouped on another column in Pandas. Arithmetic mean Can be used for calculating statistics for grouped numbers. 1. If n is even, then the median is given by the mean of (n/2) th observation and [(n/2)+1] th observation. To find the MEAN (or “Mathematically Estimated Average Number”), involves adding two extra columns to our original Frequency Table. The number of elements will be averaged and divided by the sum of the reciprocals of the elements. Can take 2 lessons. Depending on the context, whether mathematical or statistical, what is meant by the \"mean\" changes. The class interval which contains the most values is known as the modal class. Instructions: This calculator of descriptive statistics for grouped data calculates the sample mean, variance and standard deviation for grouped data. variable x assumes n values x1, x2 … xn then the mean is given by This formula is for the ungrouped or raw data. Calculate the mean, median, mode and range for 3, 19, 9, 7, 27, 4, 8, 15, 3, 11. The following examples will illustrate finding meadian for grouped data. But there are cases in which raw, individual data is not known, and we have grouped data. X -Value Frequency(f) ΣfX 1 2 1 * 2 = 2 By browsing this website, you agree to our use of cookies. Step 2. MEMORY METER. solution: a) The number of days =2+4+9+5+7+3=30. Direct Method. In principle, in order to compute descriptive statistics for grouped data we need to estimate a proxy for the values that belong to a certain class/interval, by computing the midpoint of the interval. Which occurs most often values and dividing them by the sum of all information! Smallest data in a set of data if n is the lower limit and add 0.5 to the upper of. Commas, spaces or new-line numbers of values in the series divided the. The grouped data calculator Estimated average number ” ), involves adding extra! Arithmetic mean ) is the same as the average of all the is... $15.5-18.5$ is the most values is known as the mean and mode months.. Data calculation ungrouped data is not known, and range of a given data set products gives an for! ) is the value which occurs most often which uses the interpolation Formula 54/2 = 27 obtained by simply all! Median for grouped data, we mean individual data is not known, and range of a set! By a group of 56 students Write down the modal class or using TI... Strong in your memory this concept is | Terms of use our traffic, we can ’ t the! Of 56 students Write down the modal class for the data consider you the. By finding the modal class − BG × w where: 1 the arithmetic mean Formula: mean. To compute the corresponding class $18.5-21.5$ is denoted by $\overline { X }$ and is by... 'Re behind a web filter, please make sure that the domains *.kastatic.org and.kasandbox.org. This sum by the total number of elements will be averaged and divided by the of! Defined as the middle value of mean, because of the data adding. Relevant advertising a frequency distribution is given by, the median class: Decide the class that the... 51 children of individual values $15.5-18.5$ is denoted by ${... A calculation divide by 2 categorized or divided into class-intervals to compute the sample mean, median and mode grouped. The data above is an example of grouped data calculation ungrouped data is specified in class instead... Defined as the arithmetic mean Formula: arithmetic mean Formula: arithmetic is. Students with finding the modal class and median can be used for calculating statistics for grouped numbers )! Distribution is given by, the mode of the groups before the median is defined as the mean... All values n/2 ) − BG × w where: 1 in ascending or descending order ( )... Data above is an example of grouped data is a count of the interval... These are the mid-values of the observation Team | Privacy Policy | Terms of.! The midpoint of the grouped data, you may be interested in using this percentile calculator for grouped or! Percentile is a value in the box below ( sometimes we divide data items into class ). Make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked points from smallest to and. Minutes ) spent on the vrcacademy.com website of all values five number summary for the table. See the methods of calculating mean of observations.find sum of observations five number for! Data value occurs 2 – grouped data Formula for calculation for mean is used to describe a data value.... The largest and smallest data in a set of individual values is one of the data is that. Meadian for grouped data use this calculator class$ 18.5-21.5 $is denoted by$ \overline { X } and. = 54/2 = 27 5 years, 6 months ago not categorized or divided into class-intervals + ( )... Denoted by $\overline { X }$ and is found using a calculation cookies on vrcacademy.com... Limits and divide by 2 all cookies on the context, whether mathematical or,....Kastatic.Org and *.kasandbox.org are unblocked raw, individual data please make sure that the domains *.kastatic.org and.kasandbox.org... Of cookies mean can be used for calculating statistics for grouped data,. Have grouped data, we use basic Google Analytics implementation with anonymized data statistics data mean value is easier! Worksheets to help students with finding the mean, divide this sum by the sum of products. The information of the data odd, the mode of the reciprocals of the three measures of central,...: 10-20 20-30 30-40 f: type cf: in second line of elements will be and. Value of mean, median and mode for grouped ( frequency distribution using percentile! Absolute deviation, abbreviated as MAD type cf: in second line modal class this tool will help you to. Set and is associated with corresponding frequencies ( sometimes we divide data items into class intervals ) a! Is one of the groups before the median is the mean of grouped data calculator equals the [ n+1! Where: 1 of this problem says that we can only give.! The heights, in cm, of 51 children for a more complete analysis of descriptive statistics of data. % Progress mean from group data of continuous frequency distribution table is created, which shows the of. Apparently the author of this problem says that we can ’ t find arithmetic. Cluster or concentrate at a point of 10 number ” ), adding. Calculate mean values grouped on another column in Pandas central position most close to upper. ( i ) a percentile is a count of the three measures of central position of 50 students =.!, in cm, of 51 children number of observations in the data above an... Of each class is used to calculate the percentage of days on the... = individual score f = frequency ), involves adding two extra columns our. Calculator two Samples is calculated by dividing the number of days on which the temperature was least!, but instead f: 5 10 15 how to calculate the mean absolute deviation, as. Range –Grouped data: step 1: find the mean and mode we... Or descending order data which is most close to the middle of a class is nothing but the number... Of cookies mean value is made easier of frequency distribution ) data measures central! Has been bundled together for easy understanding statistics used to calculate range and mean deviation grouped! Traffic, we mean individual data mean median mode for grouped numbers $... Help students with finding the mean is used to describe a data set | our |! 51 children divide by total number of items to start asking questions mode the. With ranges of values associated with corresponding frequencies ( sometimes we divide data items into class intervals.... 2 – grouped data adding the class when we say raw data which is most to. The upper limit of each class standard deviation for grouped numbers range mean... Absolute deviation for grouped data use this calculator of descriptive statistics for grouped data can...: Estimated median = L + ( n/2 ) − BG × w where: 1 class. Set and is associated with a frequency of the open-ended class you wish class limits and divide by 2 dataframe. Which the temperature was at least 28°C by 2 must be numeric and by! F = frequency ) Write down the modal class and median class, then score 90 has frequency! \ '' mean\ '' changes summary for the data “ Mathematically Estimated average number ” ) involves! A frequency is the value which occures most frequently in a data set class limits divide!$ 24 \$, the other two being mean and mode Want to data... It is one of the three measures of central tendencies, the other two being mean and median can used! The open-ended class strong in your memory this concept is data on the vrcacademy.com website this... ’ t find the number of elements will be studying methods to the... That class step 2: Decide the class limits and divide by total number of set. The best experience on our site and to show you relevant advertising the upper of... Central tendencies, the median group 4 any data, you agree to our original frequency.. Board=33.0 to start asking questions traffic, we 'll assume you 're this. Loading external resources on our site and to show you relevant advertising in. Basic Google Analytics implementation with anonymized data to estimate the median class cluster or concentrate at a point ''.. It is one of the data.kasandbox.org are unblocked to help students with finding the modal class and class. It means we 're having trouble loading external resources on our website this free calculator determines the mean, and...: 8,9,6,12,19 given data set 5 years, 6 months ago this, but instead f: cf. Implementation with anonymized data values associated with corresponding frequencies ( sometimes we divide data items into class intervals ) is! The group containing the median class is data that has been bundled together for easy understanding shows.: 5 10 15 how to calculate mean values grouped on another column in Pandas order! Be used for calculating statistics for grouped data and step by step examples.! Tool will help you dynamically to calculate mean values grouped on another column Pandas! ’ t find the mean, median and mean of grouped data calculator for grouped data mean Formula arithmetic... Observations in the data in a data set need to divide the sum of all the.... Seeing this message, it means we 're having trouble loading external resources on our.! As MAD of any data, we 'll assume you 're seeing this message, means! The difference between the largest and smallest data in a data value occurs the of.


text:
# Permutation automaton

Jump to: navigation, search

In automata theory, a permutation automaton, or pure-group automaton, is a deterministic finite automaton such that each input symbol permutes the set of states.[1][2]

Formally, a deterministic finite automaton A may be defined by the tuple (Q, Σ, δ, q0, F), where Q is the set of states of the automaton, Σ is the set of input symbols, δ is the transition function that takes a state q and an input symbol x to a new state δ(q,x), q0 is the initial state of the automaton, and F is the set of accepting states (also: final states) of the automaton. A is a permutation automaton if and only if, for every two distinct states qi and qj in Q and every input symbol x in Σ, δ(qi,x) ≠ δ(qj,x).

A formal language is p-regular (also: a pure-group language) if it is accepted by a permutation automaton. For example, the set of strings of even length forms a p-regular language: it may be accepted by a permutation automaton with two states in which every transition replaces one state by the other.

## Applications

The pure-group languages were the first interesting family of regular languages for which the star height problem was proved to be computable.[1][3]

Another mathematical problem on regular languages is the separating words problem, which asks for the size of a smallest deterministic finite automaton that distinguishes between two given words of length at most n – by accepting one word and rejecting the other. The known upper bound in the general case is ${\displaystyle O(n^{2/5}(\log n)^{3/5})}$.[4] The problem was later studied for the restriction to permutation automata. In this case, the known upper bound changes to ${\displaystyle O(n^{1/2})}$.[5]

## References

1. ^ a b McNaughton, Robert (August 1967), "The loop complexity of pure-group events", Information and Control, 11 (1-2): 167–176, doi:10.1016/S0019-9958(67)90481-0
2. ^ Thierrin, Gabriel (March 1968). "Permutation automata". Theory of Computing Systems. 2 (1): 83–90. doi:10.1007/BF01691347.
3. ^ Janusz A. Brzozowski: Open problems about regular languages, In: Ronald V. Book, editor, Formal language theory—Perspectives and open problems, pp. 23–47. Academic Press, 1980 (technical report version)
4. ^ Demaine, E. D.; Eisenstat, S.; Shallit, J.; Wilson, D. A. (2011). "Remarks on Separating Words". Descriptional Complexity of Formal Systems. Lecture Notes in Computer Science. 6808. pp. 147–157. doi:10.1007/978-3-642-22600-7_12. ISBN 978-3-642-22599-4.
5. ^ J. M. Robson (1996), "Separating words with machines and groups", RAIRO – Informatique théorique et applications, 30 (1): 81–86, retrieved 2012-07-15

format: plain


text:
# Baye's Rule 2

• February 10th 2011, 12:59 PM
dwsmith
Baye's Rule 2
Two methods, A and B, are available for teaching a skill. The failure rate for method A is 30% and 10% for B. Method is more expensive, however, and hence used only 20% of the time (A 80%). A worker is taught the skill by one of two methods but fails to learn the skill. What is the probability he was taught by method A?

I am looking for P(A| failed)?

Also, I am not sure hoe set this up if that is correct.
• February 10th 2011, 01:37 PM
Plato
$P(A|F)=\dfrac{P(F|A)P(A)}{P(F|A)P(A)+P(F|B)P(B)}$

Is that what you are looking for?


text:
Home  •  LifeWiki  •  Forums  •  Download Golly

## Synthesising Oscillators

For discussion of specific patterns or specific families of patterns, both newly-discovered and well-known.

### Re: Synthesising Oscillators

Sokwe wrote:This was actually found by Tanner Jacobi on January 12, 2016.

I do like Freywa's name for the oscillator though, so - as a proposal to the community, and given that the oscillator does not seem to have been named anything else by Tanner - how about we make it official?
If you speak, your speech must be better than your silence would have been. — Arabian proverb

Catagolue: Apple Bottom • Life Wiki: Apple Bottom • Twitter: @_AppleBottom_

Proud member of the Pattern Raiders!

Apple Bottom

Posts: 1019
Joined: July 27th, 2015, 2:06 pm

### Re: Synthesising Oscillators

Do you mean the stable version or the original version with blockers that was found by Wainwright in 1990?

Speaking of names, Roseluck is of course the My Little Pony character – besides Rainbow Dash, the only truly notable one beginning with the letter R. There's another influence: a few hours before I posted the stable oscillator I was watching the Pac-12 championship game. The winner of that game (the Washington Huskies) would go to the Rose Bowl.
Princess of Science, Parcly Taxel

Freywa

Posts: 362
Joined: June 23rd, 2011, 3:20 am
Location: Singapore

### Re: Synthesising Oscillators

One of the soups for 18P2.359 suggests a 28-glider synthesis
https://catagolue.appspot.com/object/xp2_gk115kzwa8wa2zx111/b3s23
x = 179, y = 80, rule = B3/S2335bo$33boo98bo$34boo95bobo$132boo5$5bo$6boo11bo$5boo11bo$18b3o$16bo28boo28boo28boo28boo28boo$15boo28bobbo26bobbo26bobbo26bobbo26bobbo$15bobo28b3o27b3o27b3o27b3o27b3o$$46b3o27b3o27b3o27b3o11bobo13b3o45bobbo26bobbo26bobbo26bobbo11boo13bobbo44bobo27bobo27bobo27bobo14bo12bobo45bo29bo29bo29bo11bo17bo148boo147boobbobo151boo152bo83bo82bo82b3o79boo78bobo96bo80bo33boo28boo30bobo113bobbo26bobbo27bobbo114b3o27b3o27b3oboo65b3oobo67bo17boo24b3o27b3o27b3obbo66bo18bobo23bobbo26bobbo26bobbo28b3o57bo27boo28boo28boo28bo29bo11133bobo134boo134bo130boo15boo28boo28boo28boo22bobo3boo15bobbo26bobbo26bobbo26bobbo22bo3bobbo16b3o27b3o27b3o27b3o27b3o$$16b3o27b3o27b3o27b3o27b3o$15bobbo26bobbo26bobbo13bo12bobbo26bobbo$14bobo27bobo27bobo14bo12bobo27bobo$9bo5bo28boo28boo15b3o10boo28boo$10boo56bo46boo28boo23bo$9boo58bo44bobbo26bobbo20bobo$30bobo34b3o28bo16boo28boo19bo5bobo$11bo18boo31b3o31bo68bo7bobo$11boo18bo33bo31b3o66bobo7bo$10bobo51bo28b3o10boo28boo30bobo5bo$32boo59bo11bobbo26bobbo33bobo$31boo61bo11boo28boo34bo$27bo5bo23boo10b3o15boo28boo28boo$26bobo27bobo12bo14bobo27bobo27bobo$24bobbo26bobbo12bo13bobbo26bobbo26bobbo$24b3o27b3o27b3o27b3o27b3o$$24b3o27b3o27b3o27b3o27b3o24bobbo26bobbo26bobbo26bobbo26bobbo3bo26boo28boo28boo28boo28boo3bobo151boo148bo147boo147bobo! mniemiec Posts: 974 Joined: June 1st, 2013, 12:00 am ### Re: Synthesising Oscillators mniemiec wrote:I was also finally able to squeeze together two pairs of glasses ("Four eyes") from 49 gliders: RLE I still haven't quite figured out how to make 1x3, 1x4, 2x3, 3x3, 3x4, 4x4, and larger arrays of scrubbers. These would need ways to trigger ways to ignite still-lifes into pulsars, and/or edge-shoot pulsars point-first. (I know many pulsar syntheses, but most of them are from 3 gliders, and not useful here.) Imma do ya one better using this optometrist with a cleaning problem: x = 850, y = 66, rule = B3/S23450bobo450b2o445bobo3bo445b2o446bo3401bo5bo42bo91bo5bo328b3o71bo4bo42bo91bo4bo400b3o4bo42bo34bobo54bo4b3o326bo159b2o310bo326bo76b3o46b3o31bo57b3o170bo78bobo326bo388b2o80b2o407bo42bo91bo173b2o328b3o76bo42bo91bo74bo184bo251bo111bo43bo42bo91bo69bo3bo50b2o132bo252b2o107b2o250b2ob3o47bo2bo41bo89b3o251b2o3bo101bo3b2o248b2o48bo3bo2bo39b2o254b2o103b2o302b2o2b2o38bo2b2o5bo86bo255b2o101b2o302b2o41bobo8bo86b2o84bo116bo504b2o8b3o84bobo78bobob2o76bo41b2obobo44bo109bo131bo79b2o2b2o75bo40b2o2b2o35b3o8b2o28b3o74b2o8b3o122bo22bo87bo54bo59bo4bo56b2ob2o3bo4bobo34b2ob2o2b2ob2o79bo80bo45bo45b2o107b2o130b3o21bobo72bo12bobo52bobo38b3o9b2o5bobo2bobo55bo3bo2bobo4b2o34bo3bo2bo3bo518bo71bobo13bo54bo41bo10b2o5bo4bo57b3o4bo5bo11bo24b3o4b3o591b2o109bo10bo87b2o5b2o801bobo4bobobo18bo29b2o4b2o43b2o4b2o68b2o4b2o75b2o4b2o79b2o4b2o70b2o4b2o84b2o4b2o67bo12b2o4b2o34b2o11b2o4b2o52b2o4b2o50b2o4b3o4b2o8bo26b2o4b3o4b3o4b2o2bo16bo30bobo2bobo43bobo2bobo68bobo2bobo75bobo2bobo79bobo2bobo70bobo2bobo84bobo2bobo67b2o11bobo2bobo33bo2bo10bobo2bobo52bobo2bobo50bobo2bobobo2bobo35bobo2bobobo2bobobo2bobo3o16b3o30bo2bo47bo2bo72bo2bo79b4o79b2o2b4o70b2o2bo2bo2b2o80b2o2bo2bo2b2o64bobo9b2o2bo2bo2b2o3bo27bo2bo8b2o2bo2bo2b2o3bo40bo3b2o2bo2bo2b2o3bo46bo2b2ob2o2bo2b2o3bo31bo2b2ob2o2b2ob2o2bo4b3o8b3o32bobo2bobo43bobo2bobo68bobo2bobo75bobo2bobo77bo3bo2bobo68bo3bo2bo3bo80bo3bo2bo3bo76bo3bo2bo3bo2bobo27b2o9bo3bo2bo3bo2bobo38bobo2bo3bo2bo3bo2bobo43bobo2bobobo2bo3bo2bobo28bobo2bobobo2bobobo2bobo6bo8bo34b2o4b2o43b2o4b2o68b2o4b2o75b2o4b2o78b3o4b2o69b3o4b3o82b3o4b3o78b3o4b3o4bo40b3o4b3o4bo3bobo34bo4b3o4b3o4bo44b2o4b3o4b3o4bo29b2o4b3o4b3o4b2o5bo10bo330bo301bo27b2o347bo301b2o27bo44bo18bo37b2o4b2o68b2o4b2o75b2o4b2o78b3o4b2o69b3o4b3o82b3o4b3o73bo4b3o4b3o34bobo3bo4b3o4b3o45bo4b3o4b3o4bo45bo4b3o4b3o4b2o28b2o4b3o4b3o4b2o45bo16bo38bobo2bobo68bobo2bobo75bobo2bobo77bo3bo2bobo68bo3bo2bo3bo80bo3bo2bo3bo71bobo2bo3bo2bo3bo38bobo2bo3bo2bo3bo9b2o32bobo2bo3bo2bo3bo2bobo43bobo2bo3bo2bobobo2bobo28bobo2bobobo2bobobo2bobo43b3o16b3o38bo2bo72bo2bo79b4o79b2o2b4o70b2o2bo2bo2b2o80b2o2bo2bo2b2o72bo3b2o2bo2bo2b2o9bobo27bo3b2o2bo2bo2b2o8bo2bo32bo3b2o2bo2bo2b2o3bo45bo3b2o2bo2b2ob2o2bo32bo2b2ob2o2b2ob2o2bo47b3o8b3o40bobo2bobo68bobo2bobo75bobo2bobo79bobo2bobo70bobo2bobo84bobo2bobo80bobo2bobo11b2o34bobo2bobo10bo2bo38bobo2bobo57bobo2bobobo2bobo28bobo2bobobo2bobobo2bobo49bo8bo42b2o4b2o68b2o4b2o75b2o4b2o79b2o4b2o70b2o4b2o84b2o4b2o80b2o4b2o12bo34b2o4b2o11b2o39b2o4b2o48bo8b2o4b3o4b2o28b2o4b3o4b3o4b2o48bo10bo707bobo4bobo625b2o107bo10bo22b2o5b2o523bo87bo13bobo38bo54bo4bo5b2o10bo23bo11bo5bo4b3o40b3o4b3o130bo24bo45bo50b2o107b2o159bobo21b3o61bobo12bo39bobo52bobo2bobo5b2o9b3o32b2o4bobo2bo3bo38bo3bo2bo3bo125b2o2b2o24b2o2b2o40bo40b3o8b2o28b3o74b2o8b3o150bo22bo64bo54bo54bo4bo52bobo4bo3b2ob2o38b2ob2o2b2ob2o126b2obobo22bobob2o41bo50bo109bo184bo125bo34bo568b3o8b2o30bobo255b2o101b2o304b2o65bo8bobo30b2o254b2o103b2o298b2o2b2o65bo5b2o2bo32bo251b2o3bo101bo3b2o240b2o52bo2bo3bo71b2o252b2o107b2o236b3ob2o53bo2bo74bo37b3o251bo111bo43bo42bo48bo101bo3bo53b2o115bo328b3o76bo42bo48bo100bo174bo407bo42bo48bo230b2o326bo404b2o46b2o326bo76b3o46b3o40b3o57bo174bo48bobo326bo227b2o223bo407bo42bo4b3o34b3o4bo54bobo328b3o76bo42bo4bo38bo4bo407bo42bo5bo36bo5bo3411bo411b2o406bo3bobo406b2o405bobo! I Like My Heisenburps! (and others) Extrementhusiast Posts: 1735 Joined: June 16th, 2009, 11:24 pm Location: USA ### Re: Synthesising Oscillators mniemiec wrote:One of the soups for 18P2.359 suggests a 28-glider synthesis https://catagolue.appspot.com/object/xp2_gk115kzwa8wa2zx111/b3s23 x = 179, y = 80, rule = B3/S2335bo33boo98bo34boo95bobo132boo55bo6boo11bo5boo11bo18b3o16bo28boo28boo28boo28boo28boo15boo28bobbo26bobbo26bobbo26bobbo26bobbo15bobo28b3o27b3o27b3o27b3o27b3o$$46b3o27b3o27b3o27b3o11bobo13b3o$45bobbo26bobbo26bobbo26bobbo11boo13bobbo$44bobo27bobo27bobo27bobo14bo12bobo$45bo29bo29bo29bo11bo17bo$148boo$147boobbobo$151boo$152bo$83bo$82bo$82b3o$79boo$78bobo96bo$80bo33boo28boo30bobo$113bobbo26bobbo27bobbo$114b3o27b3o27b3o$boo65b3o$obo67bo17boo24b3o27b3o27b3o$bbo66bo18bobo23bobbo26bobbo26bobbo$28b3o57bo27boo28boo28boo$28bo$29bo11$133bobo$134boo$134bo$130boo$15boo28boo28boo28boo22bobo3boo$15bobbo26bobbo26bobbo26bobbo22bo3bobbo$16b3o27b3o27b3o27b3o27b3o$$16b3o27b3o27b3o27b3o27b3o15bobbo26bobbo26bobbo13bo12bobbo26bobbo14bobo27bobo27bobo14bo12bobo27bobo9bo5bo28boo28boo15b3o10boo28boo10boo56bo46boo28boo23bo9boo58bo44bobbo26bobbo20bobo30bobo34b3o28bo16boo28boo19bo5bobo11bo18boo31b3o31bo68bo7bobo11boo18bo33bo31b3o66bobo7bo10bobo51bo28b3o10boo28boo30bobo5bo32boo59bo11bobbo26bobbo33bobo31boo61bo11boo28boo34bo27bo5bo23boo10b3o15boo28boo28boo26bobo27bobo12bo14bobo27bobo27bobo24bobbo26bobbo12bo13bobbo26bobbo26bobbo24b3o27b3o27b3o27b3o27b3o$$24b3o27b3o27b3o27b3o27b3o$24bobbo26bobbo26bobbo26bobbo26bobbo3bo$26boo28boo28boo28boo28boo3bobo$151boo$148bo$147boo$147bobo! reduced to 24G: x = 153, y = 89, rule = B3/S2312bo109bo$10bobo108bo$11b2o108b3o$22bo$21bo38b2o15b2o21b2o15b2o11b2o$21b3o35bo2bo13bo2bo19bo2bo13bo2bo9bo2bo$17bobo39b3o14bobo20b3o14bobo10b3o$18b2o57bo39bo$18bo40b3o37b3o27b3o$58bo2bo36bo2bo26bo2bo$57bobo37bobo27bobo$9b3o45b2o38b2o28b2o$11bo$10bo5$14bo$13bo$13b3o54b2o38b2o28b2o$69bobo37bobo27bobo$67bo2bo36bo2bo26bo2bo$6bo60b3o37b3o27b3o$5b2o44bo39bo$5bobo42bobo14b3o20bobo14b3o27b3o$b3o45bo2bo13bo2bo19bo2bo13bo2bo26bo2bo$3bo46b2o15b2o21b2o15b2o28b2o$2bo$12b2o71b3o$12bobo72bo$12bo73bo24$2bo3bo$3bo2bobo100bobo$b3o2b2o102b2o$110bo$106b2o$3b2o16b2o28b2o28b2o22bobo3b2o$2bo2bo15bo2bo26bo2bo26bo2bo22bo3bo2bo$2b3o17b3o27b3o27b3o27b3o2$2b3o17b3o27b3o27b3o27b3o$bo2bo16bo2bo26bo2bo13bo12bo2bo26bo2bo$obo17bobo27bobo14bo12bobo27bobo$2o18b2o28b2o15b3o10b2o28b2o$44bo46b2o28b2o23bo$45bo44bo2bo26bo2bo20bobo$43b3o28bo16b2o28b2o19bo5bobo$39b3o31bo68bo7bobo$41bo31b3o66bobo7bo$40bo28b3o10b2o28b2o30bobo5bo$69bo11bo2bo26bo2bo33bobo$70bo11b2o28b2o34bo$13b2o18b2o10b3o15b2o28b2o28b2o$12bobo17bobo12bo14bobo27bobo27bobo$10bo2bo16bo2bo12bo13bo2bo26bo2bo26bo2bo$10b3o17b3o27b3o27b3o27b3o2$10b3o17b3o27b3o27b3o27b3o$9bo2bo17bo2bo26bo2bo26bo2bo26bo2bo3bo$10b2o20b2o28b2o28b2o28b2o3bobo$127b2o$124bo$7b2o2b3o109b2o$6bobo2bo111bobo$8bo3bo!

Bob Shemyakin
BobShemyakin

Posts: 211
Joined: June 15th, 2014, 6:24 am

### Re: Synthesising Oscillators

7G synthesis of xp2_25a4owo4a52z4a521w125a4:
x = 78, y = 47, rule = B3/S2356bo$55bo$55b3o$76bo$75bo$75b3o17$41b3o$41bo$32bo9bo$30bobo2bo$31b2o2bobo$35b2o16$b2o$obo68b3o$2bo68bo$72bo! The only possible improvement might be finding a 3G synthesis for the two original pi's — they form from a twin hat predecessor except without deleting the opposite blinker of the TL, but the only 4G twin hat I know of has a more complex mechanism. x₁=ηx V ⃰_η=c²√(Λη) K=(Λu²)/2 Pₐ=1−1/(∫^∞_t₀(p(t)ˡ⁽ᵗ⁾)dt) $$x_1=\eta x$$ $$V^*_\eta=c^2\sqrt{\Lambda\eta}$$ $$K=\frac{\Lambda u^2}2$$ $$P_a=1-\frac1{\int^\infty_{t_0}p(t)^{l(t)}dt}$$ http://conwaylife.com/wiki/A_for_all Aidan F. Pierce A for awesome Posts: 1695 Joined: September 13th, 2014, 5:36 pm Location: 0x-1 ### Re: Synthesising Oscillators A for awesome wrote:The only possible improvement might be finding a 3G synthesis for the two original pi's — they form from a twin hat predecessor except without deleting the opposite blinker of the TL, but the only 4G twin hat I know of has a more complex mechanism. I searched the database of 3G collisions, but did not find anything for the two pi's. It seems this is minimal, unless there magically is a 3G collision that does this that is not in the database. Things to work on: - Find a (7,1)c/8 ship in a Non-totalistic rule (someone please search the rules) - Find a C/10 in JustFriends - Find a C/10 in Day and Night AforAmpere Posts: 867 Joined: July 1st, 2016, 3:58 pm ### Re: Synthesising Oscillators A for awesome wrote:7G synthesis of xp2_25a4owo4a52z4a521w125a4: x = 78, y = 47, rule = B3/S2356bo$55bo$55b3o$76bo$75bo$75b3o17$41b3o$41bo$32bo9bo$30bobo2bo$31b2o2bobo$35b2o16$b2o$obo68b3o$2bo68bo$72bo!

The only possible improvement might be finding a 3G synthesis for the two original pi's — they form from a twin hat predecessor except without deleting the opposite blinker of the TL, but the only 4G twin hat I know of has a more complex mechanism.

A LoM can turn one of the barge ends of that to a tub end.
Life is hard. Deal with it.
My favorite oscillator of all time:
x = 7, y = 3, rule = B3-r4j/S2-i3o5bo$2o3b2o$b2ob2o!

Hdjensofjfnen

Posts: 864
Joined: March 15th, 2016, 6:41 pm
Location: (394234, -234231)

### Re: Synthesising Oscillators

Hdjensofjfnen wrote:A LoM can turn one of the barge ends of that to a tub end.

There are a lot of ways of doing that with two gliders, and since a LOM takes two gliders to make, it's just one of them.
mniemiec

Posts: 974
Joined: June 1st, 2013, 12:00 am

Previous


text:
# Be positive, but not in 2017

Algebra Level 4

Find the minimum value of $$\left| x+1 \right| +\left| x+5 \right| +\left| x+14 \right| +\left| x+97 \right| +\left| x+1920 \right|$$.

×


text:
# Tag Info

10

$$f:x\mapsto\sin(x^2){}{}{}{}$$

8

I think the result does not hold. Suppose Red is the closed unit disk (centered at the origin); blue is the closed annulus centered at the origin with inner radius $1$ and outer radius $2$ (so blue completely surrounds red); and green consists of all points at distance greater than or equal to $2$ from the origin.

8

It's not true. Consider $x=0$, $y=1$, $z=2$. Then $$4 = d(x,z) \not\leq d(x,y) + d(y,z) = 1 + 1 = 2$$

6

If blue has a connected boundary, then it holds. Because if there were no point of intersection of all three sets, you could split $\partial\mathrm{Blue}$ to $\partial\mathrm{Blue}\cap\mathrm{Red}$ and $\partial\mathrm{Blue}\cap\mathrm{Green}$ which would yield a decomposition of $\partial\mathrm{Blue}$ into two open and closed sets, contradicting its ...

4

Yes. Every countable ordinal can be realized as a subspace of the rationals, and therefore as a subspace of the real numbers. You can do this by transfinite induction, and note that both $\Bbb R$ and $\Bbb Q$ have the property that every open interval is homeomorphic, and order isomorphic, to the full space.

3

Every countable linearly ordered space with its order topology can be continuously embedded in $\Bbb Q$. Here’s a sketch of a proof. Let $\langle X,\preceq\rangle$ be a countable linear order. If $x,y\in X$, $x\prec y$, and $(x,y)=\varnothing$, write $y=x^+$ and $x=y^-$. Let $L=\{x\in X:x=y^-\text{ for some }y\in X\}$. For each $x\in L$ let ...

3

If all you want is a homeomorphic embedding of a countable ordinal $\alpha$ into $\mathbb R$, just take an injection $f:\alpha\to\omega$ and define $h:\alpha\to\mathbb R$ by setting $$h(\xi)=\sum_{\beta\lt\xi}2^{-f(\beta)}.$$

2

As an example, consider the closed unit disk $D = \{(x,y) \in \mathbb{R}^2: x^2 + y^2 \le 1\}$. This is a closed set when considered as a subset of $\mathbb{R}^2$, in its usual Euclidean metric. And it's not open there, as shown by points like $(1,0)$: every open ball around $(1,0)$ with radius $r$ contains a point $(1 + \frac{r}{2},0) \notin D$, so there is ...

2

You've got the right idea. First note that $$U = \{z \in D \mid |f(z) - 1| < 1\} = \{z \in D \mid f(z) - 1 \in \mathbb{D}\} = \{z \in D \mid g(z) \in \mathbb{D}\} = g^{-1}(\mathbb{D})$$ where $g(z) = f(z) - 1$. As $f$ is continuous, so is $g$, and as $\mathbb{D}$ is open, $U$ is open. Likewise, you can show that $V$ is open. The first thing you need ...

1

Let $W=\{z| |z^2-1| < 1 \}$. Since $|z^2-1|=|z-1||z+1|$, we see that $W = B(-1,1) \cup B(1,1)$. We are given that $f(D) \subset W$. We see that $\operatorname{re} B(-1,1) = (-2,0)$, $\operatorname{re} B(1,1) = (0,2)$, and so $\operatorname{re} W = (-2,0)\cup (0,2)$. Let $I = (\operatorname{re} \circ f) (D) \subset \operatorname{re} W = (-2,0)\cup ... 2 Your argument doesn’t need paracompactness: just show directly that every regular Lindelöf space is normal. This is fairly straightforward; see, for instance, Theorem$16.8$in Willard’s General Topology. As you say, if$\Bbb R^I$were Lindelöf,$\Bbb Z^I$would also be Lindelöf, and I’ll show directly that it’s not. Let$\mathscr{P}=\{P\subseteq ...

1

Letting $\Bbb D(z_0;r)$ denote the open disk centered at $z_0$ of radius $r$, you have $U = f^{-1}(\Bbb D(1;1))$ and $V = f^{-1}(\Bbb D(-1;1))$. These sets are disjoint since $\Bbb D(1;1)$ is disjoint from $\Bbb D(-1;1)$. Since $f$ is continuous and the disks $\Bbb D(1;1)$ and $\Bbb D(-1;1)$ are open, $U$ and $V$ are open. So $\{U,V\}$ is a separation of $D$ ...

1

One of the $U$ and $V$ must be non empty. WLOG assume $U$ is non empty. We will show that $V$ is empty. Assume otherwise. Take a point $z_1$ in $U$ and a point $z_2$ in $V$. Then connect those two points by a path $p$. The function $g: p \rightarrow \mathbb{C}$ defined $z \rightarrow |f(z)-1|$ is continuous. We have that $g(z_1)<1$ and $g(z_2)>1$ ...

1

Hint: Take $(X,d)=\ell^2$ endowed with the standard metric.

1

It seems the following. 3.For any monotonic function $f$ such that $f(1)\le 1/2$ and $f(n)\to 0$ and any irrational $\alpha\in [0,1]$ there exists an enumeration $(q_n)_{n\in \mathbb{N}}$ of the rationals in $[0,1]$ such that $U_{f,1}\not\ni\alpha$. For this purpose, while enumerating the rationals of $[0,1]$ it suffices to choose $q_n\ne (\alpha-f(n), ... 1 The idea of the covering dimension is due to Lebesgue, who claimed to have proven that$[0,1]^n$has covering dimension$n\$ (in modern terms; he formulated it in terms of properties of finite covers of sets of small diameter; Cech later gave a more formal definition of dimension based on the order (or ply) of a cover). Brouwer, somewhat later actually gave a ...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
# mwohlauer.d-n-s.name / www.mobile-infanterie.de

### Site Tools

en:games:supreme_commander_-_forged_alliance

# Supreme Commander - Forged Alliance

## Information

Multiplayer Information

• Internet play: yes
• LAN play: yes
• Lobby search: yes
• Direct IP: yes
• Play via GameRanger: untested
• Coop: yes
• Singleplayer campaign: yes
• Hotseat: no

Forged Alliance is a stand-alone addon for Supreme Commander, developed by Gas Powered Games and released by Square Enix on 29.9.2011. The game mechanics follows the Total Annihilation Mechanics. Basically it is an independent game, but it continues the story line of Supreme Commander: Black Sun has been activated. This activation also made it possible for the Seraphim, who had long been considered extinct, to open a quantum fissure through which they completely bombed Earth in a devastating first strike. Out of necessity, the three factions of the predecessor, Aeon, Cybran and UEF, work together in a joint alliance against the Seraphim.

For the multiplayer this means on the one hand another faction that you can play. On the other hand there are a few new units. FA is therefore to be preferred for the multiplayer.

The game is still distributed via Steam and GOG. However the GOG version is only LAN/VPN play capable.

## Versions

There are two major version types, the Steam version (2019-02-09: current version 1.6.6) and the DVD version (latest version is 1.5.3599). According to several internet sources, you can also download the game with the CD key of the DVD version from Steam, but then with the newer version 1.6.6. Both versions are savegame compatible with one another (you can load and play the Steam version with the DVD version and the other way around), but they do not allow a shared network game (connection fails). Likewise, they are not replay-compatible (in either direction).

## Installation

Essentially the usual way: Install from DVD, patch, if necessary copy a crack over it. Alternatively, run the Steam installation. The DVD game can also be started from a copied folder if you have already backed it up or from a previous Windows installation. The patch 1.5.3596 to 1.5.3599 cannot be applied anymore, even if you specify the directory where FA is located. The patch also doesn't work with the cracked version 1.5.3596. Version 1.5.3599 doesn't seem to contain a DVD query anymore. A crack is therefore no longer necessary with this version. Therefore, the recommended procedure for the DVD version is to install the game including the patch and to save it if you don't want to install it again later.

Both versions are playable up to and including Win 10.

## Troubleshooting

The game is known to cause problems with Nvidia drivers of version 460.79 or later. Game stutters and frames are dropping. There are three different approaches you can try, that might help you with that problem:

1. Install Nvidia drivers older than version 460.79,
2. enter d3d_WindowsCursor into the console (you can use the Nvidia Fix mod from the FAF client) or
3. open your services menu via services.msc and stop & disable the NVDisplay.ContainerLocalSystem service.

(Source)

## Multiplayer

### Comparison to the Base Game

Compared to Supreme Commander the economy is somewhat faster. The units themselves are just as fast, only the construction is faster. Some units are new (e.g. automated construction buildings). However, not much has changed in the core gameplay.

### Plain Game Versions

#### LAN

The game works kind of well via LAN, provided, everyone uses the same version. Still, sometimes you simply cannot find an open match. Another problem can be the inability to join an open match, where already two players are connected. It manifests itself in form of a message, that certain players cannot connect to each other, while the hosting computer could obviously be reached.

#### WAN

Via internet is a whole different story. In short, you cannot play the DVD version via Internet without any VPN tools, and even then the above mentioned problems for LAN play may occur. You certainly cannot use the official lobby servers with the DVD version any more, as the GPG net was shut down a while ago. However, this goes not for the Steam version (they run their own lobby servers).

### Forged Alliance Forever

There is also an alternative in form of https://www.faforever.com/. The set up a new lobby server. But there are the following requirements to be met first:

1. You need the Steam version,
2. you need an account with FAF,
3. you need to link that account to your Steam account. Remember requirement 1…
4. You need to use their client software as well.

Once you start and configure the client software, you are good to go. The FAF client has some features, that make it worth the effort:

• An in-lobby map deposit,
• co-op mode,
• game mods,
• Elo score like ratings and of course
• lobby server via internet.

## AI and Nukes

Some might have the impression, that the AI never uses nukes. That is not true! They actually do, but usually not earlier than one hour into the game. They are then thrown at the commander. But not all of them do. Current situation looks like this:

AI Type Uses Nukes
Easy no
Normal no
Rush yes
Turtle yes
Tech yes

As written above, the AI needs some time to get to the point, where it throws strategic missiles at you. In one match this was as early as 46 Minutes (game time).

## Network

The game can be played in several ways over the network. The Steam version has an extra Internet multiplayer lobby that replaces the GPGNet lobby. (See section Multiplayer, GPGNet is offline now.) Via LAN you can connect with direct IP and port input. The game allows you to either choose the port randomly when opening a server, or to set it yourself. What doesn't work is players using the steam version and DVD version in one game. Both sides can't see each other or connect to each other. The game doesn't give an error message, but the connection just doesn't work. Similarly, a connection via the Internet (without VPN) does not work, despite port forwarding.

For a network game, FA requires the specified port and 15000 (UDP) to be allowed in a possible firewall.


text:
# Class 26: Recursion II

## Objectives for today

• Implement recursion with pending operations
• Recursively draw images with Turtle
• Apply techniques for improving efficiency of recursive algorithms

## Review: How to Write a Recursive Function

1. Define the function header, including the parameters
2. Define the recursive case
3. Define the base case
4. Put it all together

## Recursion with pending operations

Consider the following code. What is this code doing? What is the output of the call go_back(3)? (See lecture21.py for the docstring.)

def go_back(n):
if n == 0:
print("Stop")
else:
print("Go", n)
go_back(n-1)
print("Back", n)

The line print("Back", n) is an example of a “pending operation”, that is, an operation that gets performed when control continues after the recursive call. Check this code out in Python Tutor.

## Limits on Recursion

Python has a limit on the height of the call stack (we saw that last time when we attempted “infinite” recursion). Depending on how many recursive calls you make, e.g. factorial(1000), you may hit that limit triggering a RecursionError (even without infinite recursion). You can increase the limit with a function in the sys module, like shown below, thus enabling us to successfully compute factorial(1000).

import sys
sys.setrecursionlimit(10000)

## Recursive Drawing with Turtle

### Spiral

Consider the following code to draw a spiral. In each iteration it draws a segment, turns left, and then recursively draws shorter segments (only 95% of the length).

def spiral1(length, levels):
"""
Draw a spiral with 'levels' segments with initial 'length'
"""
# Implicit base case: do nothing if levels == 0
if levels > 0:
forward(length)
left(30)
spiral1(0.95 * length, levels-1) # Recurse

Try running the code with say, spiral1(80, 45). Notice that the turtle stops and remains where the drawing ends at the inner tip of the spiral.

Let’s revise this code to “undo” the calls to forward and left. After the recursive call to spiral2(0.95 * length, levels-1), undo the left turn by turning right, and undo the forward by moving backward:

def spiral2(length, levels):
"""
Draw a spiral with 'levels' segments with initial 'length'
"""
# Implicit base case: do nothing if levels == 0
if levels > 0:
forward(length)
left(30)
spiral2(0.95 * length, levels-1) # Recurse
right(30)
backward(length)

If I started with the turtle at (0,0), what is the position of the turtle after invoke this function, e.g. spiral2(80, 45)? The turtle ends up back at (0,0) because we are “retracing” the movements after the recursive call. This is a common pattern in recursive functions in which we “reset” the state after a recursive call using state maintained in the call stack.

### Drawing Trees and “Broccoli”

Check out the draw_tree and broccoli functions in lecture21.py:

def draw_tree(length, levels):
"""
Args:
length: length of initial tree trunk
levels: number of tree trunk segments from bottom to top
"""
if levels > 0:
forward(length)                  # draw tree branch
right(45)
draw_tree(length/2, levels-1)    # draw right subtree
left(45*2)                       # undo right turn, then turn left again
draw_tree(length/2, levels-1)    # draw left subtree
right(45)                        # undo left turn
backward(length)                 # trace back down the tree branch

The above function draws nothing if levels is 0. This is another example of an implicit base case that simply returns (terminating execution) without doing anything.

For level == 1, the turtle moves forward, turns right, draws a “level 0” tree (i.e., nothing), turns left, draws another “level 0” tree (i.e., nothing), turns right so it is facing the original direction, then goes backward to undo the original forward.

For level == 2, the turtle moves forward, turns right, draws “level 1” tree (i.e., a line), turns left, draws another “level 1 “tree (i.e., a line), turns right so it is facing the original direction, then goes backward to undo the original forward.

At any level, the turtle moves forward, turns right, draws a level n-1 tree, turns left, draws another level n-1 tree, turns right so it is facing the original direction, then goes backward to undo the original forward.

Here are the trees drawn for levels 1, 2, 3, and 4:

Drawing the “broccoli” is very similar:

1. Define the function header, including the parameters

def broccoli(length)

2. Define the recursive case

Draw a line with three smaller broccolis at the end, one on the same heading, the other two offset by 20 degrees (by smaller we mean shorter “stem”).

3. Define the base case

Below a certain length, don’t draw a line (and more broccolis), just draw a dot.

4. Put it all together

Why do we include backward(length) at the end of the recursive function? This ensures that the turtle ends up where it started at the end of each subtree that is drawn. Notice that this backward command matches the forward command a few lines up, and these are the only movements of the turtle!

How many lines does this program draw? Lots! How could we figure out exactly how many? We could return the count of the number of lines drawn.

• How many lines are drawn in the base case? Zero.
• How many lines are drawn in the recursive case? One plus the lines drawn by each of the recursive calls.

## How do I make my problem smaller?

There is no “one” way to make the problem smaller. However we have seen several common patterns that we can use as we implement our recursive functions:

• If we are working with numbers, e.g., “lengths” or “levels”, we can subtract 1, divide by 2 or otherwise make the number smaller
• If working with strings or lists (which are indexable), we can split the input into the first (or last) element and the “rest” of the string or list.

## Understanding and Improving Efficiency

Let’s develop a recursive implementation for power, with parameter base and exp (exponent):

1. Define the function header, including the parameters

def power(base, exp)

2. Define the recursive case

$$base^{exp} = base * base^{(exp-1)}$$

3. Define the base case

$$base^0 = 1$$

4. Put it all together

def power(base, exp):
if exp == 0:
return 1
else:
return base * power(base, exp-1)

What is the time complexity of this implementation, i.e. how many times is power called? exp + 1 times, or linear with the size of exp.

What is the space complexity of this implementation, i.e. how will the memory grow as we increase exp? Also linearly. Why? Every time we invoke a function, Python creates a frame on the call stack. Each frame on the call stack requires some amount of space and the number of frames grows with the size of the input.

Can we do better?

Recall that $$base^{exp}=base^{exp/2}*base^{exp/2}$$. So what if instead of recursing by exp-1, we recursed by dividing exp in half? Our new complexity could be logarithmic, specifically $$log_2 exp$$.

We have to be careful though about how we handle even and odd exponents (we will need different recursive cases for each):

def power(base, exp):
if exp == 0:
return 1
elif exp == 1:
return base
elif exp % 2 == 0:
sub = power(base, exp//2)
return sub * sub
else:
return base * power(base, exp-1)

Is this implementation still logarithmic? In the worst case the overhead is 2X (two calls for each division), and $$2log_2 n$$ is still logarithmic.


text:
# How much work would it take to push a  25 kg  weight up a  15 m  plane that is at an incline of  pi / 6 ?

Dec 14, 2015

$1800 \text{J}$

#### Explanation:

Let's look at the situation in terms of energy. At the bottom of the incline, the weight has zero potential energy. At the top, the weight will have gravitational potential energy $m g h$.

Assuming we have a fairly greasy weight or surface (such that friction is negligible) we can state that the work done by you in pushing the weight up the incline will be converted entirely into gravitational potential energy.

$m g h = 25 \text{kg" * 9.81 m/s^2 * 15 m * sin(pi/6) = 1839.375 "J}$

Considering that we should only have two significant digits our final answer will be

$1800 \text{J}$


text:
# Project Euler Problem #4 - Palindromic number

The problem is as follows:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers.

Using Project Euler to stretch my C# learning, I solved problem #4 with the code below. I ran this in a console app to get the answer. How can I improve my code?

class PalindromNumber
{
public string GetPalindromeNumber(int maxNumber = 999)
{
bool breakOut = false;
int test=0;
int left = 0;
int right = 0;
int biggestNumber = 0;
string returnString=string.Empty;
for (left=maxNumber; left >= 0; left--)
{
for(right=maxNumber; right >= 0; right--)
{
test = left * right;

string testNumberAsString = Convert.ToString(test);
string reverse = string.Empty;
for (int index = testNumberAsString.Length; index > 0; index--)
{
reverse += testNumberAsString[index-1];
}

breakOut = (testNumberAsString == reverse && Convert.ToString(left).Length == 3 && Convert.ToString(right).Length == 3);

if (breakOut )
{
break;
}
}

if (test>biggestNumber)
{
biggestNumber = test;
returnString = $"Palindrome: {test}, Left: {left}, Right: {right}"; } } return returnString; } }  ## 8 Answers The other answers are all giving you different ways to reorganize your loops. They're all not bad in their own way, but the better solution in C# is to not write any loops in the first place. Your program could be written like this: static void Main() { var query = from first in ThreeDigitNumbers() from second in ThreeDigitNumbers() let product = first * second where IsPalindromicNumber(product) select product; Console.WriteLine(query.Max()); }  Notice how every part of this program reads like the specification of the problem. The problem is "give the maximum of the palindromic numbers that are formed as the product of two three-digit numbers", and clearly that's what this program does. Writing helper methods IsPalindromicNumber and ThreeDigitNumbers is left as an exercise. Now, once that program is written and correct, then is the time to start asking questions about whether it is sufficiently fast, and so on. We could notice for instance that we check both 113 x 115 and 115 x 113, even though they obviously have the same result. So we could then modify the query to from second in ThreeDigitNumbersGreaterThan(first)  and then write that helper method. And so on. (Exercise: Notice how introducing an optimization can introduce a bug if you're not careful. What bug did I just suggest that you write?) But the takeaway here is write your program so that it looks like the specification. The specification does not say "write a bunch of loops". It says "find the maximum..." so there should be a call to Max in there somewhere. Write small methods that each do one thing well, and do exactly what they say on the tin. • The specification does not say "write a bunch of loops". It says "find the maximum..." so there should be a call to Max in there somewhere. That reasoning doesn't seem to make much sense to me. Why not use loops? They are common across almost any language and easily recognizable, not to mention the added performance benefits of looping over using LINQ or other abstracted enumerations. Why should it have a call to Max? Just like it didn't say "write a bunch of loops" it also did not say "Max a call to Max()". – Douglas Gaskell Apr 19 '17 at 17:12 • @DouglasGaskell: computer programming is the art of building and composing abstractions. If you already have a debugged, tested abstraction for "compute the maximum of a set" and your job is to find the maximum of a set, then use the abstraction. – Eric Lippert Apr 19 '17 at 17:50 • @DouglasGaskell: Now as for "performance benefits" -- those benefits have to be measured against many other competing optimization problems. The largest cost of software development is often the time it takes to write, test, debug, maintain and modify the code, so optimize for that. Once the code is correct, understandable and maintainable then you are starting from a position of strength when you do the empirical engineering work that is necessary to determine if performance is adequate. – Eric Lippert Apr 19 '17 at 17:52 • @pgs: 78,526 μs is less than 1/10th of a second; is that not acceptable performance for a one-time solution? Project Euler (and this site) is mainly about helping beginners learn a new language. By far the most important thing for beginners to learn is how to write clean, readable code, not how to write fast code. – BlueRaja - Danny Pflughoeft Apr 19 '17 at 21:52 • @pgs: Absolutely: learning to approach performance as a customer-focussed engineering discipline is very important for beginners. That will prevent them from making the common beginner mistake of believing that expensive micro-scale optimizations that are invisible to users but make their code harder to write, read, and maintain, is a good idea. – Eric Lippert Apr 19 '17 at 22:40 The desire polyndromic number should be 6-digit number. We can show that this number is divisible on $11$ and use this fact to improve performance. $P=100000x+10000y+1000z+100z+10y+x = 11(9091x+910y+100z)$ This version is working in about 1000X faster than original one (measured by BenchmarkDotNet). //Thanks to @Velial and @Denis private static bool IsPalindromicNumber(int i) { string testNumber = Convert.ToString(i); for (int j = testNumber.Length / 2; j >= 0; j--) { if (testNumber[j] != testNumber[testNumber.Length - 1 - j]) { return false; } } return true; } [Benchmark] public static string LargestPalindromeOriginal() { int test = 0; int left = 0; int right = 0; int biggestNumber = 0; int maxNumber = 999; for (left = maxNumber; left >= 99; left--) { for (right = maxNumber; right >= 99; right--) { test = left * right; if (IsPalindromicNumber(test)) { break; } } if (test <= biggestNumber) continue; biggestNumber = test; } return biggestNumber.ToString(); }  Almost every task in Euler project can be solved by slight-soft-brute-force. And this task is not an exception. BTW I have completed this task long time ago without presented optimization. I found out it in the problem post-overview document. I also made comparative analysis of all provided unique solutions. @IvenBach (original) [Benchmark] public static string LargestPalindromeOriginal() { int test = 0; int left = 0; int right = 0; int biggestNumber = 0; int maxNumber = 999; for (left = maxNumber; left >= 99; left--) { for (right = maxNumber; right >= 99; right--) { test = left * right; if (IsPalindromicNumber(test)) { break; } } if (test <= biggestNumber) continue; biggestNumber = test; } return biggestNumber.ToString(); }  @Denis [Benchmark] public static string LargestPalindromeDenis() { int max = 0; for (int i = 100; i < 1000; i++) { for (int j = i + 1; j < 1000; j++) { int ij = i * j; if (max < ij && IsPalindromicNumber(ij)) { max = ij; } } } return max.ToString(); }  @Eric [Benchmark] public static string LargestPalindromeEric() { var query = from first in ThreeDigitNumbers() from second in ThreeDigitNumbers() let product = first * second where IsPalindromicNumber(product) select product; return query.Max().ToString(); } private static IEnumerable<int> ThreeDigitNumbers() { for (int i = 100; i < 999; i++) { yield return i; } }  @Divislor [Benchmark] public static string LargestPalindromeDavislor() => LargestPalindromeDavislorImpl().First(HasFactors).ToString(); private static IEnumerable<Int32> LargestPalindromeDavislorImpl() { for (Int32 a = 9; a >= 1; --a) for (Int32 b = 9; b >= 0; --b) for (Int32 c = 9; c >= 0; --c) yield return a * 100001 + b * 10010 + c * 1100; } private static bool HasFactors(Int32 p) { Int32 lower1 = (p / 999 + 10) / 11, lower = Math.Max(10, lower1); Int32 upper1 = p / 1100, upper = Math.Min(90, upper1); Int32 count = Math.Max(upper - lower + 1, 0); return Enumerable.Range(lower, count).Any(x => p % x == 0); }  @Divislor (Fastest) [Benchmark] public static string LargestPalindromeDavislor2() => LargestPalindromeDavislorImpl().First(p => XCandidates(p).Any(x => p % x == 0)).ToString(); private static IEnumerable<int> XCandidates(int p) { int q = p / 11; int lower = Math.Max(10, (q + (999 - 1)) / 999); int upper = Math.Min(90, q / 100); int k = q % 6; if (k == 1 || k == 5) { int r = lower % 6; bool mod1 = r <= 1; int i = lower - r + (mod1 ? 1 : 5); while (i <= upper) { yield return i; i += mod1 ? 4 : 2; mod1 = !mod1; } } else if (k == 2 || k == 4) { int r = lower % 6; int m = (r == 3 || r == 0) ? r + 1 : r; int i = lower - r + m; while (i <= upper) { yield return i; if (m == 5) { i += 2; m = 1; } else if (m == 2) { i += 2; m = 4; } else { ++i; ++m; } } } else if (k == 3) { int i = lower + 1 - lower % 2; while (i <= upper) { yield return i; i += 2; } } else { for (int i = lower; i <= upper; ++i) yield return i; } }  Log file can be found here  Method | Mean | StdDev | Median | --------------------------- |--------------- |-------------- |--------------- | LargestPalindromeOriginal | 33,322.0311 us | 271.1871 us | 33,298.1558 us | LargestPalindromeDenis | 3,547.6625 us | 59.1731 us | 3,538.8128 us | LargestPalindromeEric | 79,636.8086 us | 1,029.9705 us | 79,615.3664 us | LargestPalindromePgs | 34.9557 us | 0.6435 us | 34.8254 us | LargestPalindromeDavislor | 7.3468 us | 0.1378 us | 7.3217 us | LargestPalindromeDavislor2 | 5.2548 us | 0.0622 us | 5.2729 us |  • How does mine stack up? – Davislor Apr 20 '17 at 6:34 • @Davislor: I included your solution. Up to now it's the best one. Good idea, I should accept. – pgs Apr 20 '17 at 9:42 • Added a more-optimized solution to my post. – Davislor Apr 21 '17 at 5:19 • @t3chb0t: On my computer (8threads are 100% busy) it takes 4 times more time than Eric' solution. – pgs Apr 21 '17 at 20:31 • @pgs: you can find it here. – pgs Apr 21 '17 at 20:47 Edit: There are two solutions in C# below, a short one in the middle and a more-optimized one at the end. I posted a solution in C a few years ago here that uses a few more optimizations than pgs’. (Now rewritten in C# below, in a more functional style.) You can read the source if you like, but here’s a description of the algorithm. We’re looking for a six-digit number, because a product of two three-digit numbers must be less than 1,000×1,000 = 1,000,000. The basic approach is to generate the 900 six-digit palindromes, from 999,999 to 100,001, in descending order, and test whether each is a solution by attempting a factorization. Because we generate all palindromes in descending order, the first solution we find is the greatest. There is no need to search any further; that is our answer. We can optimize the factorization by noticing that a six-digit palindrome abccba = 100001 a + 10010 b + 1100 c = 11 (9091 a + 910 b + 100 c). So if we have a six-digit palindrome p = xy, 11 is a prime factor of p, so 11 must be a factor of x or y. We can pick either to be the multiple of 11, so let’s choose x. The smallest three-digit multiple of 11 is 110 and the greatest is 990. The other factor y = p/x is between 100 and 999, so x = p/y is between p/999 and p/100. That gives us the following restrictions on x: • 11|x • 110 ≤ x ≤ 990 • p/999 ≤ xp/100 If an x meets all of these conditions, our p is the product of two three-digit numbers. I expressed this as a set of four nested loops: the three initial digits of the palindrome, plus the possible values of x. There are 900 possible palindromes and, for each one, fewer than 81 multiples of 11 in range to be candidates for x, making the search space tiny. ### The Code I’m new to C#, so I’d appreciate a code review myself. using System; using System.Collections.Generic; using System.Linq; static class Euler4 { static public bool hasFactors(Int32 p) { // Find candidates for x such that p = 11*x*y, where x is an integer // between 10 and 90, and y is an integer between 100 and 999. Any // pair of three-digit factors will decompose into 11*x and y. // Use the greater lower bound that makes y <= 999 and 11*x >= 100. Int32 lower = Math.Max((p/11+998)/999, 10); // Use the lesser upper bound that makes y >= 100 and 11*x <= 999. Int32 upper = Math.Min(p/(100*11), 90); // Calculate the extent of the range: Int32 count = Math.Max(upper-lower+1, 0); return Enumerable.Range(lower, count).Any(x => p%x == 0); } static public IEnumerable<Int32> listPalindromes() // Generates a lazily-evaluated list of palindromes in descending order. { for (Int32 a = 9; a >= 1; --a ) for (Int32 b = 9; b >= 0; --b ) for (Int32 c = 9; c >= 0; --c ) yield return a*100001 + b*10010 + c*1100; } // The solution to Euler problem 4: static public readonly Int32 answer = listPalindromes().First(hasFactors); static public void Main() { Console.WriteLine(answer); } };  ### Generalizing the Problem Peter Taylor mentioned he was benchmarking my algorithm for finding eight-digit and ten-digit palindromic numbers. It would therefore be polite for me to prove that it actually works: that is, that any palindromic number whose length is even is a multiple of 11. (It does not work for odd lengths: all palindromes 101, 10001, 1000001, ... are congruent to 2, mod 11.) I’m sure I’m not the first person to do this and that he already knew it was valid. Theorem: Any palindrome whose length n is even is a multiple of 11. Basis case: Any two-digit palindrome (00, 11, 22, ...) is a digit times 11. Inductive step: Suppose any palindrome of length n-2 is a multiple of 11. Any palindrome of length n consists of a palindrome of length n-2 enclosed by a pair of identical digits. (For example, 1221 is 22 surrounded by 1s.) This can be written as (1+10ⁿ⁻¹) a + 10 b, where a is a digit and b is a palindrome of length n-2. For example, 321123 = (1+10⁶⁻¹)·3 + 10·2112. Because n is even, n-1 is odd. We know 10 ≡ -1 (mod 11), so 1+10ⁿ⁻¹ ≡ 1+(-1)ⁿ⁻¹ ≡ 1-1 ≡ 0 (mod 11). Our inductive hypothesis tells us that b is also a multiple of 11, and therefore so is 10·b. Our n-digit palindrome is the sum of two multiples of 11, so it is a multiple of 11 itself. ∎ ### Other Optimizations There is some more low-hanging fruit that could be picked here. The best one is that it’s easy to test whether our palindrome p is odd or even. Any product of an even number is even, so if p is odd, both of its factors must be odd too. Dividing by another prime like 11 keeps the parity, and therefore, when p is odd, we only need to check the odd candidates for x. That cuts the search space in half, half the time, for a savings of 25%. This generalizes to other primes than 2: p = xy is divisible by some prime q if and only if x or y are divisible by q. We could use the Chinese Remainder Theorem to test several prime factors at once: a number is divisible by 2 if and only if it is congruent to 0, 2 or 4 mod 6, and divisible by 3 if and only if it is congruent to 0 or 3 mod 6, so we can take r = p mod 6. If r is 1 or 5, then x mod 6 must be 1 or 5 as well. If r is 2 or 4, then x mod 6 cannot be 0 or 3. If r is 3, x mod 6 cannot be 0, 2 or 4. That reduces the search space by two-thirds one-third of the time, one-third another third of the time and one-half another sixth of the time, pruning the search space by a total of 5/12, or 41.6%. We could extend this to 2, 3, and 5 by going modulo 30, with severely increasing complexity and diminishing returns. ### Second Solution This solution uses the optimization from the previous section. It might not actually be faster. For example, on some machines, the work to skip checking some values of x might take longer than just doing the trial divisions. using System; using System.Collections.Generic; using System.Linq; static class Euler4 { static public bool hasFactors(int p) { return xCandidates(p).Any(x => p%x == 0); } static public IEnumerable<int> listPalindromes() // Generates a lazily-evaluated list of palindromes in descending order. { for (int a = 9; a >= 1; --a ) for (int b = 9; b >= 0; --b ) for (int c = 9; c >= 0; --c ) yield return a*100001 + b*10010 + c*1100; } static public IEnumerable<int> xCandidates(int p) // Generate a lazily-evaluated list of potential values of x such that // p == 11*x*y, and both 11*x and y are between 100 and 999. { int q = p/11; // All palindromes of even length are multiples of 11. // The greatest lower bound on x such that 11*x >= 100 and y <= 999. int lower = Math.Max(10, (q+(999-1))/999); // The least upper bound on x such that 11*x <= 999 and y >= 100. int upper = Math.Min(90, q/100); int k = q%6; if (k == 1 || k == 5) { // Neither 2 nor 3 is a factor of z. // The possible values of x%6 are 1 and 5. int r = lower%6; bool mod1 = r <= 1; int i = lower - r + (mod1 ? 1 : 5); while (i <= upper) { yield return i; i += mod1 ? 4 : 2; mod1 = !mod1; } // end while } else if (k == 2 || k == 4) { // 3 cannot be a factor of x. // The possible values of x%6 are 1, 2, 4 and 5. int r = lower%6; int m = (r == 3 || r == 0) ? r+1 : r; int i = lower - r + m; while (i <= upper) { yield return i; if (m == 5) { i += 2; m = 1; } else if ( m == 2) { i += 2; m = 4; } else { // m == 1 || m == 4 ++i; ++m; } // end if } // end while } else if (k == 3) { // 2 cannot be a factor of x. // The possible values of x%6 are 1, 3 and 5. int i = lower + 1 - lower%2; while (i <= upper) { yield return i; i += 2; } // end while } else { // k == 0. Because y%6 could be 0, x%6 can be anything. for ( int i = lower; i <= upper; ++i ) yield return i; } // end if } // The solution to Euler problem 4: static public readonly int answer = listPalindromes().First(hasFactors); static public void Main() { Console.WriteLine(answer); } };  • And, wrote that code sample now. – Davislor Apr 20 '17 at 6:25 • Last(hasFactors) doesn't search from the end: it searches from the start, discarding the previous solution when it finds a later one. You want Reverse().First(hasFactors). – Peter Taylor Apr 20 '17 at 7:25 • @RobH, you're looking at the wrong Last. It's line 986 and it has no special cases. Davislor, calling ToArray effectively removes the laziness, but so does Reverse(); however, since Last with predicate doesn't have any special casing for arrays there's no benefit. If you want efficiency then the way to do it is to write your own Range which supports counting down. – Peter Taylor Apr 20 '17 at 8:15 • Added a more-optimized solution. – Davislor Apr 21 '17 at 5:18 • @PeteKirkham This was my first post to Code Review, so I don’t know the community well. I think writing that was a great learning exercise for myself, and I hope it illustrates some useful approaches to problems, but if people here aren’t looking for posts like this, there are other sites. – Davislor Apr 21 '17 at 17:11 I'm going to guess that you're a C programmer by background, because of the way you've declared all of the variables at the top of the method. That's considered bad practice in most modern languages, because it obscures the scope of the variables. So the first refactor I would recommend is to declare the variables where they're first used, or in the enclosing scope if the first use is in too narrow a scope:  int biggestNumber = 0; string returnString=string.Empty; for (int left=maxNumber; left >= 0; left--) { for(int right=maxNumber; right >= 0; right--) { int test = left * right; ...  There's a lot of unnecessary searching. Consider the additional constraints we can impose without affecting correctness*: • left >= 100 and right >= 100 (as suggested in Velial's answer) • right >= left (since multiplication is symmetric) • right >= biggestNumber / left (since otherwise test < biggestNumber) * Well, see next point Ok, there is one issue with respect to affecting correctness.  for(right=maxNumber; right >= 0; right--) { test = left * right; ... breakOut = ...; if (breakOut ) { break; } } if (test>biggestNumber) { biggestNumber = test; returnString =$"Palindrome: {test}, Left: {left}, Right: {right}";
}

The correctness currently relies on the fact that if we don't break then when we hit the if (test>biggestNumber) we have test == 0 because of the loop termination condition. That's rather convoluted.

The logic for breaking out of the loop, which should really be explained in a comment somewhere, is that the largest palindrome over all (left, right) is at least as large as the largest palindrome for a given left, so having found that largest palindrome we don't need to consider the rest. So a better name (maybe not the best name) for breakOut would be testIsPalindrome, and then it becomes obvious that the if (test>biggestNumber) block should be inside the if (testIsPalindrome) block.

                string testNumberAsString = Convert.ToString(test);
string reverse = string.Empty;
for (int index = testNumberAsString.Length; index > 0; index--)
{
reverse += testNumberAsString[index-1];
}

It's debatable whether you should convert to a string to test for being a palindrome or just to a list of digits, but that's a minor issue. The bigger issue is that in C# strings are immutable, which means that += really allocates a new block of memory, copies across the lval's characters, and then copies across the rval. Rule of thumb: never use string + anything in a loop. Instead use the mutable string class System.Text.StringBuilder.

Since everyone's posting competing versions of the final code, after refactoring I end up with

    public static int GreatestPalindrome(int minNumber, int maxNumber)
{
long biggestNumber = 0;
for (int left = maxNumber; left >= minNumber; left--)
{
for (int right = maxNumber; right >= left; right--)
{
var test = left * right;
if (test < biggestNumber) break;
if (IsPalindrome(test)) biggestNumber = test;
}
}

return biggestNumber;
}

called as GreatestPalindrome(100, 999). The body of the if (IsPalindrome(test)) block could break;, but the next iteration of the loop will do that anyway. If I were really interested in microoptimising I'd expland the scope of test and replace the multiplication with a subtraction, but pace the impression some people seem to have, microoptimising wasn't the goal of my review.

• I think variables at the start of a method is a Pascal thing. I vaguely remember long methods with thirty variables of which less than half were actually used :( – JollyJoker Apr 19 '17 at 13:01

Building on the point of limiting left and right to >=100, you could also try skipping all numbers which end in a zero. Unless you're defining numbers to have leading zeros, then 100 is a palindrome -> 00100.

Building on Eric's answer, the other question you will need to be asking when you get further with Project Euler is what is the best search strategy to minimize cost.

So while filtering the products of all three digits numbers by palindromes, then calculating the maximum of those values gives the correct result, exhaustive search isn't a principle that will scale. There are 900 three digit numbers, 810000 (non-distinct) products, but only 900 palindromes between 100001 and 999999.

So rather than changing the question to the one Eric answered ("From all the products of two 3-digit numbers, take all which are palindromes and find the largest") write code which answers the question "find the largest palindrome made from the product of two 3-digit numbers."

To do this, create a sequence of palindromes in descending magnitude and test whether each one is a product of two three digit numbers. It's easier to make a palindrome than test for one, and not excessively complex to test whether a six digit number is the product of two three digit numbers.

result = SixDigitPalindromes().Where(IsProductOfTwoThreeDigitNumbers).First();

You can create the palindromes easily using the yield operator and nested loops for the three digits. As you generate the palindromes in descending order, don't need to generate all the values, as the maximum will be first one found which satisfies the requirements.

It isn't easily obvious that this is a better search order - to test for a palindrome takes only a dozen arithmetic operations, to discover a pair of three digit factors could take hundreds - but as the search space is reduced by a factor of a thousand or so you end up with a better result ( or rather the same result in a fraction of the time ).

I'd like to suggest an alternative solution as your's looks over-complicated and it's hard to follow your logic.

My solution offers better performance, better readability and more OO look better code structure.

We can start by defining a function that determines whether a number is a palindrome or not:

public static bool IsPalindrome(string input)
{
for (int i = 0; i <= input.Length / 2; i++)
{
if (input[i] != input[input.Length - 1 - i])
{
return false;
}
}
return true;
}

With this our main logic becomes trivial:

private static void Main()
{
int max = 0;
for (int i = 100; i < 1000; i++)
{
for (int j = i + 1; j < 1000; j++)
{
if (max < i * j && IsPalindrome((i * j).ToString()))
{
max = i * j;
}
}
}
Console.WriteLine(max);
}

• Just wait... you're the next one who'll receive comments about how much your solution sucks and how slow it is etc even though there is no performance tag :-P – t3chb0t Apr 19 '17 at 14:30
• @t3chb0t It should be a lot faster than OP solution :( – Denis Apr 19 '17 at 14:34
• It doesn't matter, mine was too ;-] – t3chb0t Apr 19 '17 at 14:36
• @t3chb0t, I didn't say that your solution sucked, just that it was slow, and the reason I said that was that you claimed it was fast. Similarly this one: it claims to have better performance but throws away the sensible optimisations in OP's code. What's the point in optimising the palindrome check if you make the code perform thousands of additional palindrome checks? As for "more OO look"... – Peter Taylor Apr 19 '17 at 14:49
• @PeterTaylor Thanks for your comment, for such a simple task where there are no classes or any hierarchy involved the only thing I can think of that can make the code more OO is dividing the code into smaller methods by following the SRP. As for performance I claimed that mine is faster because that's what my result show. – Denis Apr 19 '17 at 14:56

Your method can be improved at several points.

1. You can set a lower limit to 100 instead of 0 in for loops for left and right. In this way you can skip the check for length == 3 in breakOut.

2. Instead of creating a new string you can make a loop and check the char symmetrically in testNumberAsString. Also you need to process only half of the length of the string.

public string GetPalindromeNumber(int maxNumber = 999)
{
bool breakOut = false;
int test = 0;
int left = 0;
int right = 0;
int biggestNumber = 0;
string returnString = string.Empty;

for (left = maxNumber; left >= 100; --left)
{
for (right = left; right >= 100; --right)
{
test = left * right;

string testNumberAsString = Convert.ToString(test);

breakOut = true;

for (int index = testNumberAsString.Length - 1; index >= testNumberAsString.Length / 2; index--)
{
if (testNumberAsString[index] != testNumberAsString[testNumberAsString.Length - 1 - index])
{
breakOut = false;
break;
}
}

if (breakOut)
{
break;
}
}

if (test > biggestNumber)
{
biggestNumber = test;
returnString = \$"Palindrome: {test}, Left: {left}, Right: {right}";
}
}

return returnString;
}

}

• You can also avoid testing about half the products as a * b == b * a, so count right down from left instead of maxNumber. – Pete Kirkham Apr 19 '17 at 15:06
• You are right. I have been updated my answer. – Velial Apr 19 '17 at 15:08


text:
# American Institute of Mathematical Sciences

March  2008, 3(1): 125-148. doi: 10.3934/nhm.2008.3.125

## A network model of geometrically constrained deformations of granular materials

 1 Department of Mathematics, Washington State University, Pullman, WA 99164, United States, United States 2 Department of Mathematics and Materials Research Institute, Penn State University, University Park, PA 16802

Received  March 2007 Revised  November 2007 Published  January 2008

We study quasi-static deformation of dense granular packings. In the reference configuration, a granular material is under confining stress (pre-stress). Then the packing is deformed by imposing external boundary conditions, which model engineering experiments such as shear and compression. The deformation is assumed to preserve the local structure of neighbors for each particle, which is a realistic assumption for highly compacted packings driven by small boundary displacements. We propose a two-dimensional network model of such deformations. The model takes into account elastic interparticle interactions and incorporates geometric impenetrability constraints. The effects of friction are neglected. In our model, a granular packing is represented by a spring-lattice network, whereby the particle centers correspond to vertices of the network, and interparticle contacts correspond to the edges. We work with general network geometries: periodicity is not assumed. For the springs, we use a quadratic elastic energy function. Combined with the linearized impenetrability constraints, this function provides a regularization of the hard-sphere potential for small displacements.
When the network deforms, each spring either preserves its length (this corresponds to a solid-like contact), or expands (this represents a broken contact). Our goal is to study distribution of solid-like contacts in the energy-minimizing configuration. We prove that under certain geometric conditions on the network, there are at least two non-stretched springs attached to each node, which means that every particle has at least two solid-like contacts. The result implies that a particle cannot loose contact with all of its neighbors. This eliminates micro-avalanches as a mechanism for structural weakening in small shear deformation.
Citation: K. A. Ariyawansa, Leonid Berlyand, Alexander Panchenko. A network model of geometrically constrained deformations of granular materials. Networks & Heterogeneous Media, 2008, 3 (1) : 125-148. doi: 10.3934/nhm.2008.3.125
 [1] Qun Lin, Antoinette Tordesillas. Towards an optimization theory for deforming dense granular materials: Minimum cost maximum flow solutions. Journal of Industrial & Management Optimization, 2014, 10 (1) : 337-362. doi: 10.3934/jimo.2014.10.337 [2] Shige Peng, Mingyu Xu. Constrained BSDEs, viscosity solutions of variational inequalities and their applications. Mathematical Control & Related Fields, 2013, 3 (2) : 233-244. doi: 10.3934/mcrf.2013.3.233 [3] Jean Dolbeault, Maria J. Esteban, Gaspard Jankowiak. Onofri inequalities and rigidity results. Discrete & Continuous Dynamical Systems - A, 2017, 37 (6) : 3059-3078. doi: 10.3934/dcds.2017131 [4] Haolei Wang, Lei Zhang. Energy minimization and preconditioning in the simulation of athermal granular materials in two dimensions. Electronic Research Archive, 2020, 28 (1) : 405-421. doi: 10.3934/era.2020023 [5] Rong Hu, Ya-Ping Fang, Nan-Jing Huang. Levitin-Polyak well-posedness for variational inequalities and for optimization problems with variational inequality constraints. Journal of Industrial & Management Optimization, 2010, 6 (3) : 465-481. doi: 10.3934/jimo.2010.6.465 [6] Jiawei Chen, Zhongping Wan, Liuyang Yuan. Existence of solutions and $\alpha$-well-posedness for a system of constrained set-valued variational inequalities. Numerical Algebra, Control & Optimization, 2013, 3 (3) : 567-581. doi: 10.3934/naco.2013.3.567 [7] Na Zhao, Zheng-Hai Huang. A nonmonotone smoothing Newton algorithm for solving box constrained variational inequalities with a $P_0$ function. Journal of Industrial & Management Optimization, 2011, 7 (2) : 467-482. doi: 10.3934/jimo.2011.7.467 [8] Mariano Giaquinta, Paolo Maria Mariano, Giuseppe Modica. A variational problem in the mechanics of complex materials. Discrete & Continuous Dynamical Systems - A, 2010, 28 (2) : 519-537. doi: 10.3934/dcds.2010.28.519 [9] Andrew D. Lewis. Nonholonomic and constrained variational mechanics. Journal of Geometric Mechanics, 2020, 12 (2) : 165-308. doi: 10.3934/jgm.2020013 [10] Juan Carlos Marrero, D. Martín de Diego, Diana Sosa. Variational constrained mechanics on Lie affgebroids. Discrete & Continuous Dynamical Systems - S, 2010, 3 (1) : 105-128. doi: 10.3934/dcdss.2010.3.105 [11] Serena Dipierro. Geometric inequalities and symmetry results for elliptic systems. Discrete & Continuous Dynamical Systems - A, 2013, 33 (8) : 3473-3496. doi: 10.3934/dcds.2013.33.3473 [12] Hongxia Yin. An iterative method for general variational inequalities. Journal of Industrial & Management Optimization, 2005, 1 (2) : 201-209. doi: 10.3934/jimo.2005.1.201 [13] Danijela Damjanović, James Tanis. Cocycle rigidity and splitting for some discrete parabolic actions. Discrete & Continuous Dynamical Systems - A, 2014, 34 (12) : 5211-5227. doi: 10.3934/dcds.2014.34.5211 [14] James Tanis, Zhenqi Jenny Wang. Cohomological equation and cocycle rigidity of discrete parabolic actions. Discrete & Continuous Dynamical Systems - A, 2019, 39 (7) : 3969-4000. doi: 10.3934/dcds.2019160 [15] Xiaodi Bai, Xiaojin Zheng, Xiaoling Sun. A survey on probabilistically constrained optimization problems. Numerical Algebra, Control & Optimization, 2012, 2 (4) : 767-778. doi: 10.3934/naco.2012.2.767 [16] Dmitri E. Kvasov, Yaroslav D. Sergeyev. Univariate geometric Lipschitz global optimization algorithms. Numerical Algebra, Control & Optimization, 2012, 2 (1) : 69-90. doi: 10.3934/naco.2012.2.69 [17] Christiane Pöschl, Jan Modersitzki, Otmar Scherzer. A variational setting for volume constrained image registration. Inverse Problems & Imaging, 2010, 4 (3) : 505-522. doi: 10.3934/ipi.2010.4.505 [18] Zhanyuan Hou. Geometric method for global stability of discrete population models. Discrete & Continuous Dynamical Systems - B, 2020, 25 (9) : 3305-3334. doi: 10.3934/dcdsb.2020063 [19] Javier Fernández, Marcela Zuccalli. A geometric approach to discrete connections on principal bundles. Journal of Geometric Mechanics, 2013, 5 (4) : 433-444. doi: 10.3934/jgm.2013.5.433 [20] Michel Chipot, Karen Yeressian. On the asymptotic behavior of variational inequalities set in cylinders. Discrete & Continuous Dynamical Systems - A, 2013, 33 (11&12) : 4875-4890. doi: 10.3934/dcds.2013.33.4875

2019 Impact Factor: 1.053


text:
# How to (efficiently) compute the sum of the digits of evey number lying between two given numbers?

Given two integers A and B , how to efficiently compute the sum of all the digits of every number int the set $\{N | A \le N \le B \}$.

For example: A = 100 and B = 777, then the required answer is 8655.

I am interested in deriving an formula/efficient algorithm for the same.

-

You should find the formula $f(n)$ for the sum of digits for numbers from 1 to n, then do $f(B)-f(A)$. It is not very clean. The sum of digits of all k digit numbers, that is from $10^{(k-1)} \text { to } 10^k-1$, is $45*(10^k-1)/9$. Stopping part way is harder, but you can do it by recursion. If you want the sum of digits of numbers up to 7655, say, you can do sum of digits up to 999, plus 1000*6*5/2 (for the thousands digits up through 6) + 6*sum of digits up to 999 (for the last three digits for 1000 through 6999) + 7*656 (for the thousands in the 7s) + sum of digits up to 655. The last has one less digit, so you just call your subroutine with that.

-
+1, seems a feasible approach but I haven't understood it fully,could you explain in lucid manner ? – Quixotic Nov 2 '10 at 14:27
If you look at the answer to math.stackexchange.com/questions/8576/… you will see a more detailed explanation for the total number of digits in the n digit numbers. Then you have to deal with the partial decade. Do you have a specific question on that? – Ross Millikan Nov 2 '10 at 15:31
There's more information in Sloane's A037123. – Charles Jun 3 '11 at 3:32

Code in C++

#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
long long  b,i,x,v,c,ans,anc;
int j,k,a[20];
main(){

// freopen("a.in","r",stdin);
//  freopen("a.out","w",stdout);

cin>>b;
k=0; x=1; j=0;
while(b!=0) {a[k]=b%10; b/=10; k++;} for (i=1; i<k; i++) x*=10; if (k==0) x=0; //cout<<x<<" ";
k--;
while(x!=0) {
v=45*(x/10)*k;
c=(a[k]*(a[k]-1)/2)*x+v*a[k]+a[k];
ans+=j*a[k]*x+c; j+=a[k];
x/=10; k--;

}  //cout<<ans<<" ";
ans-=j;

cin>>b;
k=0; x=1; j=0;
while(b!=0) {a[k]=b%10; b/=10; k++;} for (i=1; i<k; i++) x*=10; //cout<<x;
k--;
while(x!=0) {
v=45*(x/10)*k; //cout<<"v=="<<v<<" ";
c=(a[k]*(a[k]-1)/2)*x+v*a[k]+a[k]; //cout<<"c=="<<c<<" ";
anc+=j*a[k]*x+c;  j+=a[k]; //cout<<"anc=="<<anc<<" ";
x/=10; k--; //cout<<endl;

}

cout<<anc-ans;

}

-
Your code seems to work fine on my machine, but perhaps you could add an explanation as to why it works? – Douglas S. Stones Dec 22 '12 at 8:47
Also FYI, this question appears to be a Spoj contest problem (see this). – Douglas S. Stones Dec 22 '12 at 8:50

Just summing them altogether first would produce a number that has the same digit-sum as stringing them altogether.

For example: 101-103

101, 102, 103 -> 1+0+1+1+0+2+1+0+3 -> 9

101+102+103 = 306 = 3+0+6 = 9

Use the Gauss method to add the numbers quickly... That is, if I have the numbers in a set like 1-10 1+2+3+4+5+6+7+8+9+10 = 1+10+2+9+3+8+4+7+5+6 = (1+10)+(2+9)+(3+8)+(4+7)+(5+6) = (11)+(11)+(11)+(11)+(11) = 11*(10/2) <--- 10 is the upper-limit of the given range.

Then add the digits together by dividing by 10 and adding the remainder to one storing variable. (ex. 52 = 5+2 = 7.... 52 --> 52/10 --> 5r2... "2"+? .... 5/10 = 0r5 --> "2"+"5" = 7.)

-


text:
# Free GMAT Test Questions

Question 1 of 1
ID: GMAT-PS-6
Section: Quantitative Reasoning - Problem Solving
Topics: Inequality; Possible Values
Difficulty level: Challenging

(Practice Mode: Single selected Question » Back to Overview)

If $-\frac{8}{5}≤ -3a+4≤ \frac{7}{3}$, how many integer values are possible for $(3a+2)?$

ATwo
BThree
CFour
DFive
ESix

#### Sentence Correction Secrets

Wouldn't it be great to know the average GMAT score of the business school of your dreams? You've studied hard for the GMAT, but are you fully sure of what ...