Question: I added buttons to xib as normal using iOS 6 SDK and Xcode 4.5.

When I run the app on iOS 6 simulator, there is no problem. But when I run it on the iOS 5.x simulator (or device), the title on the button always disappears(not every time). Lots of my view controllers have this problem.

![enter image description here](https://i.stack.imgur.com/QxPfV.png)

**PS: Only Custom type button have this problem**

![enter image description here](https://i.stack.imgur.com/wF7Xf.png)

**Found the reason:**  

 [[UIButton appearanceWhenContainedIn:[UISearchBar class], nil] setTitle:@"取消" forState:UIControlStateNormal]

Answer: 
What you are doing is [trial divison](http://en.wikipedia.org/wiki/Trial_division) - testing each candidate prime against each known prime below it. Skipping odd numbers in the call to `range` will save you some divisions, but this is exactly the technique sieveing is based on: you know that every second number is divisible by 2, and therefore composite. The sieve just extends this to:

* every third number is divible by three, and therefore composite;
* every fifth by five, and therefore composite

and so on. Since the Sieve is regarded as one of the most time-efficient algorithms available, and trial division as one of the *least* (wikipedia describes the sieve as `O(n log log n)`, and per the comments below, your algorithm is likely `O(n^2 / log n)`) ) , it is reasonable to assume that trial division with some Sieve-like optimisation falls short of sieving.
Since `range` in Python 2 returns a list, your algorithm's space complexity is still `O(n)`, so it is not more space efficient (at least not asymptotically). If you used xrange (or range in Python 3), it would be somewhat more space efficient because you'd only be storing the primes - not all numbers up to `n`.

Your time efficiency will be worse than a sieve either way.