I just came across with this interesting question from my colleague. I'm trying now, but meanwhile I thought I could share it here.
With the password grid shown in the Android home screen, how many valid passwords are possible? min password length: 4 max: 9 (correct me if I'm wrong)
Summary
The full combinations of 4 to 9 distinctive numbers, minus the combinations which include invalid "jump"s.
The Long Version
The rule for Android 3x3 password grid:
one point for once
cannot "jump" over a point
The author of the original post used Mathematica to generate all 985824 combinations.
Because there is no "jump", several pairs of consecutive points are invalid.
Delete all invalid combinations to reach the result.
The combinations for 4-to-9-point paths are respectively 1624, 7152, 26016, 72912, 140704, 140704.
The Original Post In Chinese
The reference is from guokr, a site alike Stack Exchange Skeptics in the form of blogs.
(No of Points- Valid patterns) (4 - 746) (5 - 3268) (6 - 11132) (7 - 27176) (8 - 42432) (9 - 32256)
Total of 117010 valid Patterns are possible
I brute forced the answer with a recursive search and i found a bigger answer, 487272. The algorithm is simple: trying it all. I quoted it down here. I didn't found any error in my code (but I'm not very skilled with c++). Sorry for the grammatical error I'm not English.
I know this question is old, but I answered it in another question (before finding this question) with a brute force approach in python, so adding it here for posterity:
So you can list all the # of patterns for any number of steps:
This is not the most efficient way of solving it because you could use reflections and only calculate a 4*corner + 4*mid-edge + 1*middle, e.g.: