# Combinations for Screen lock For iPhone / Android

I was wondering if there was a general for formula to calculate the combination of the password lock for the current smart phones

The following is the condition

1. We must use four nodes or more to make a pattern at least.
2. Once anode is visited, then the node can't be visited anymore.
3. You can start at any node.
4. A pattern has to be connected.
5. Cycle is not allowed.

If using 4 as the minimum string for the password with 9 nodes , the result is 389112.

Is there anyway to estimate the number of combinations for 16 nodes, 25 nodes and so on?

-
The number 389112 shows up exactly once at the Online Encyclopedia of Integer Sequences, at oeis.org/A160743 where it's $8P_7(n)$, Legendre polynomial of order 7. I doubt it's related, just thought I'd save others the trouble of consulting OEIS. – Gerry Myerson Nov 26 '12 at 4:29
This question is closely related. It's very nearly a duplicate, including the same image and wording, except it doesn't ask about the generalization to larger grids. – joriki Nov 26 '12 at 4:31
Note that the answer $389112$ is obtained if the rules specified in this other duplicate are assumed. If these are the intended rules, the present problem description is incomplete. – joriki Nov 26 '12 at 4:48
@GerryMyerson I am just learning about Legendre Polynomials and I am glad of you mentioning it. I did not know that Legendre Polynomials will be useful for these types of problems. – diimension Nov 26 '12 at 5:50
@dii, did you see where I wrote, "I doubt it's related"? – Gerry Myerson Nov 26 '12 at 6:22

Since each dot can be the starting point for the pattern, the number of possibilities are as follows:

1. 4 dots combination (since this is the minimum required): 9 dots (starting points) ^ (raise to the power) 4 = 6,561 patterns
2. 5 dots combination: 9 dots ^ 5 = 59,049 patterns
3. 6 dots combination: 9 dots ^ 6 = 531,441 patterns
4. 7 dots combination: 9 dots ^ 7 = 4,782,969 patterns
5. 8 dots combination: 9 dots ^ 8 = 43,046,721 patterns
6. 9 dots combination: 9 dots ^ 9 = 387,420,489 patterns

Total possible number of patterns = 435,847,230 patterns

-
That's not right. The dot sequence must be connected. – Tyler Nov 10 '13 at 16:07