Summin’ 1s

On Jimmy Salvatore’s awesome math blog, Dying Lovegrape, he considers the fun problem of finding the sum 1+11+111+\ldots+11111\ldots In the course of thinking about the problem, he finds some interesting methods for speeding up the addition process, but ultimately yearns for a closed form solution like a scurvied pirate for a lime tree. Here we present such a solution, which uses a trick we used in a past post on credit cards and amortization.

The first step is to look at the terms in the series, 1,11,111,1111, etc. What we can notice is that any number in the sequence is just the previous number multiplied by 10 and added to 1. For instance, 1111=10(111)+1. Let’s turn this into an analytic expression by promoting the multiplier 10 to the variable r. And, as an example, let’s say we want to calculate 4th term in the sequence in terms of r. When we perform this algorithm, we are evaluating the expression

(((1*r+1)*r+1)*r+1)

which, as we shown in the amortization post, expands to

r^3+r^2+r+1

which is a geometric series. This particular term is equal to \frac{r^{4}-1}{r-1} and in general, the nth term is equal to \frac{r^{n}-1}{r-1}.

So, this gives us a neat way of writing each term in the sequence, all of which we must now sum together.

I.e., if we end at the nth term, the sum is t_n, we must find t_1+t_2+\ldots+t_n

We can write this analytically as

\sum\limits_{h=1}^{n}\frac{r^{h}-1}{r-1}=\frac{1}{r-1}\sum\limits_{h=1}^{n}\left(r^{h}-1\right)

Of course, all of the 1′s in the sum just add up to n, so the only thing left to do is to add up all of the terms r^{h}, but we have already done this, and it is again a finite geometric series. The only trick we do is to pull a factor of r in front of the sum so that we have the typical geometric series, i.e.

\frac{1}{r-1}\left(r\sum\limits_{h=0}^{n-1}r^{h}-n\right)

now, it is clear that upon evaluating the geometric series in the last expression that we will get

\frac{1}{r-1}\left(\frac{r}{r-1}\left(r^{n}-1\right)-n\right)=\frac{1}{(r-1)^2}\left(r^{n+1}-(1+n)r+n\right)

Now, if we plug in r=10 as it is in the original problem, we find that the sum of the first n terms is given by  the closed form expression \frac{1}{81}\left(10^{n+1}-10-9n\right). Below, we plot the function along with data points from summing the first 1, 2, 3, 11 and 13 terms on a calculator.

Finally, we evaluate the formal expression for values of n from 1 to 30. As expected, they agree with the partial sums found by hand. The number in the left column corresponds to the number of terms and the number on the right is the sum of the terms.

Update

I realized that the comparison of Jimmy and a scurvied pirate is all the more delightful, since at one point in his life (unless I am mistaken), he actually gave himself scurvy (in the 21st century no less) via his surreal infatuation with eating sauteed mushrooms, and evidently, little other than sauteed mushrooms for months on end. I love Jimmy more than I can really know.

War for Oil

I’m not too familiar with the extent of corruption in reconstruction era Iraq, but it seems to be a rather contemptible offense, at least if it is done by the wrong people.

For example, three South Korean military officers, jobbed with doling out reconstruction contracts in Iraq, were found to have threatened and bribed a Kurdish contractor for $25,000 in addition to a digital camera. The risk this posed to coalition harmony was so grave that the lead conspirator received three years in South Korean military prison. Even worse, an anonymous quote from a senior American official was issued,  factually labeling the acts “…a clear case of extortion between the Kurds and the Koreans.”

In another instance, GE overstepped its bounds in jockeying the Iraqi Ministry for Oil and Health for pole position in the sale of medical supplies and machinery used in the purification of drinking water. So grave was this offense that the SEC wiped out the $18.6 million gain with a $23 million fine. Moreover, and importantly, the SEC stated that “this case affirms that law enforcement is active across the globe — offshore does not mean off-limits.” American Justice cannot be escaped. It sees no boundaries. It sees no colors. It sees no bank statements. Justice will prevail.

I can only imagine what would happen if evidence became available which proved that America initiated a similar sort of bribe. Not to influence mere details of million dollar
reconstruction contracts, but for something somewhat more monumental. What if it were true that America bribed a foreign country to enter into a war that had no legitimate justification and would one day result in the death of 100,000+ innocent Iraqi civilians?

Behold:

Continue reading

Twitter is censoring the discussion of #Wikileaks

Twitter, the very popular 140 character social networking site, has a feature called “Trends” and is supposed to capture what the most popular topics of discussion are, at any given time. When people “Tweet” about a given topic, they can insert what is called a hash tag into their Tweet. For example, if I wanted to Tweet about Richard Feynman, and I wanted other people interested in Richard Feynman to be able to find it, I could put something like “#Feynman” within my post. Twitter would then automatically categorize this post under “Feynman” and voila, people can search for it on Twitter. This is how “Trends” are calculated. If say, within a given time span of perhaps 10 minutes, a million people put the tag #Christmas into their tweets, and this would be a very popular Twitter topic and should make it into the “Trends” list. Simple enough.

Today, as I was scouring the web for everything I could find about the censoring of Wikileaks and Julian Assange’s legal status I had a growing feeling of unease that Twitter was actively censoring the discussion of Wikileaks. New Tweets filed under the tag #Wikileaks were popping up at an astounding pace. If I left the page alone for literally 30 seconds, 40 new Tweets tagged as #Wikileaks would be there when I returned. It just seemed like #Wikileaks would be one of the most popular topics and therefore be reported as a “Trend”, but I really had no way to quantify this.

But then I found an excellent applet hosted by trendistic.com. It allows one to type in whatever hash tag terms they like and it will then compile a graph of how popular that hash tag term was over the course of whatever time period you select. In theory, since #Wikileaks is not a “Trend” as recognized by Twitter, every single term that Twitter lists as a Trend should outperform #Wikileaks. However, this simply is not the case. My web programming skills are not so good as my other talents, so I’ve yet to program this in the dynamically updating form that I envision, but here goes:

Continue reading

Bob Murphy’s haphazard and embarrassing essay on the Amazon boycott

Logo used by Wikileaks

I don’t want this to be a blog that enters into battles with other blogs and drags on into territory so arcane that only news addicts will remotely care. But, the more I thought about this article by Bob Murphy, the more it baffled me. While parts of it make a lot of sense, portions of it are infused with a non-committal, almost passionate ambivalence that is hard to understand.

A few days ago, after Wikileaks started to leak the first installments of the diplomatic cables, an anonymous hacker launched a denial of service attack against the Wikileaks site, which at that time was hosted by a relatively low traffic service provider. The attack forced the site to transmit data at rates in excess of 10 Gb/s which the small service provider literally could not sustain, legitimately forcing them to part with Wikileaks. In order to combat this, Wikileaks purchased space with Amazon’s hosting service. Amazon offers hosting based on “cloud” computing. Under this scheme, access to a website is massively distributed, and the hosted sites are generally impervious to elementary denial of service attacks. This hosting prompted Senator Joe Lieberman (I-Connecticut) to use his office staff to inquire to Amazon why they were still doing business with Wikileaks. It is important to note that unlike the original server, Amazon is the 9th most visited website in the world.

Since Amazon decided to boot the entrenched Wikileaks organization from using their robust cloud website hosting services, many people have independently decided to economically boycott Amazon and, also, to encourage others to do the same. In their weak response, Amazon both denies that government intervention had anything to do with their decision and attempts to couch the reaction in terms of a violation of their terms of service, while repeating the lie that Wikileaks dumped 250,000 cables, which it has not.

Daniel Ellsberg

Quickly, civil liberties heroes such as the popular constitutional scholar Glenn Greenwald and the legendary Daniel Ellsberg, leaker of the Pentagon Papers, jumped onboard and lent their resounding support. The logic behind this seems straightforward, Amazon made the decision to end business with Wikileaks, these people strongly disagree with that decision, and they no longer want to support Amazon. However, Bob Murphy, a writer on the Libertarian blog of Lew Rockwell makes some bizarre objections to this idea. I will address the most confusing parts of his piece.

Continue reading

solving the random walk

The philosophy of the EMH boils down to a model of a stock market whose behavior is random due to perfect efficiency. Given its simplicity, this stock pricing picture can be solved exactly, and in a variety of ways. In preparation for a future post, where we’ll solve the biological problem of a stochastic gene expression circuit, I’ll make use of something moderately fancy, a generating function. The random walk is characterized by a particle, that at each point in time, will pick a random direction and then move itself  a given distance along that direction. As an example, if an object is currently at position n on a line, there is one half chance that it moves to n-1 and one half chance that it moves to n+1. To solve this, we want to find formulas that tell us how far a typical object will be from its starting point as a function of time. Of course, each individual particle will take a different trajectory, but exact quantitative statistical properties can be obtained without much work. We’ll take the simple discretized case where particles move the same unit distance at each step. A diagram for the flow of particle for this process is shown below:

\displaystyle \left[n-1\right]\longleftrightarrow \left[n\right]\longleftrightarrow \left[n+1\right]

Continue reading

(in)efficient market hypothesis

A Crocs display in a shop

Image via Wikipedia

A popular approach to understanding the stock market is to assume that it is efficient, implying that prices always reflect the true supply and demand for an item, and that all knowable information is known and has been taken into account. If this description were true, then it would be impossible to infer anything about the future of a market from looking at its current behavior. This would also make it hard to understand the success of firms like Jane Street or the Process Driven Trading unit at Morgan Stanley. In general, this approach to the market assumes many questionable things, including the idea that traders can have complete knowledge of mounting social trends they’re probably completely unaware of. There are likely things that someone in another profession could predict, that a trader could not, for instance, a high school student could predict Crocs to be a terrible plan for a shoe, way before the market caught on. Had kids been investing, this short might have happened sooner. Similarly, it pretends investors have no fear or greed or other emotions that may cause irrational group-think. If there is just one irrational investor, a infinitesimal inefficiency must exist.

Continue reading

Is this the real life? (man in the sky)

There are perfectly legitimate reasons to be skeptical of the sureness with which some climate scientists predict catastrophes. Despite the incredibly complex and conditional nature of the process they model, some can come across as if they think their work is beyond reproach. Personally (knowing full well how hard it is to say anything certain about a system which has only relatively few variables, such as a gene circuit), I find it hard to accept on principle that people understand the climate to the extent they say they do. Despite my objections, John Shimkus scares the hell out of me.

I think it is healthy (and impossible not to) doubt the efficiency of government to handle all problems. But without any direct experience, it is somewhat speculative for me to say anything about what goes on in congress on a daily basis. For all I know, maybe the lobbying class runs absolutely everything, or maybe the problems facing the congress are just really hard and take an infinite amount of time to solve, or maybe they just play Candy Land all day. Enter the congressman from Illinois:

John Shimkus has just won his eighth term to the House of Representatives. Since 1997, he has been a member of the House Committee on Energy and Commerce, the panel founded in 1795 to guide American policy on public health, the supply of energy, air quality and the state of the environment. When I see phrases like public health, energy, environment I have wild and irrepressible visions of empirical data collection, science in action, computers churning out reams of graphs and equations telling people what happens when A touches B, etc… Continue reading

lake limbo (credit card payments)

In a country where banks have been entrusted with the infinite servitude of the ambiguously PrivatePublic treasury system, it is no surprise when they choose to operate as close to the financial fringe as possible. Whereas a morally sound long term strategy on the part of the banks would recognize universal economic robustness to be a good sign of future progress and development, the increasingly myopic banks focus themselves on establishing systems that serve no useful economic service. Is it better to have a nation of free people, comfortable enough in their lives to innovate and Go For It, or to foster environments that can lure decent people into embarrassing situations that leave them forever paying loans with no hope of paying off interest in a finite timespan? (There are of course, complete morons that involve themselves in extravagant credit card debt for no good reason, but there are also people at the end of their rope who have few alternatives).

The lenders can make a killing in either situation, but only one of them results in the guarantee of a profit free of any hard work.  As part of my always active campaign to delight myself to the wonder of mathematics, I set out to find some exciting quantities that touch upon the principal ideas used to snooker people in. The post will, truly, use nothing that is beyond the reach of any bright 7th grader. Continue reading

see what’s really there (proposition 19 polls)

Here’s something that’s important and happening today. There’s been a huge amount of attention given to polls on the support of Proposition 19, the bill to legalize marijuana in California according to state law. Over the summer, public support was relatively high, but lately, it’s been steadily declining and at last check was losing by a small margin. I am wondering, how bad is this news for the proposition? Can ~600 people really lock onto the real public sentiment? This post is meant to explore the sampling process in these polls and to make some statements about the possibility of Proposition 19 passing in light of them. Continue reading

Blog at WordPress.com.
Theme: Esquire by Matthew Buchanan.

Follow

Get every new post delivered to your Inbox.