OFFSET
0,2
COMMENTS
Since Android unlock patterns must have length between 4 and 9 (inclusive), there are a(4) + ... + a(9) = 389112 total Android unlock patterns. - Nathaniel Johnston, Jan 10 2014
LINKS
Blog, Counting Unlock Patterns
StackOverflow, Number of possible paths in android pattern lock, Jan 5, 2016
EXAMPLE
There are 9 points to start a unlock pattern with. So there are 9 paths of length 1. Therefore a(1) = 9.
PROG
(Python)
def f(p, s, x={1:{3:2, 7:4, 9:5}, 2:{8:5}, 3:{1:2, 7:5, 9:6}, 4:{6:5}, 5:{}, 6:{4:5}, 7:{1:4, 3:5, 9:8}, 8:{2:5}, 9:{1:5, 3:6, 7:8}}):
return int(s==0) or sum(f(p+[n], s-1) for n in (n for n in range(1, 10) if (not p or n not in p and (n not in x[p[-1]] or x[p[-1]][n] in p))))
print([f([], s) for s in range(10)]) # Matej Veselovac, Mar 16 2021, based on StackOverflow entry for Jan 5, 2016
CROSSREFS
KEYWORD
fini,full,nonn
AUTHOR
Daan van Berkel (daan.v.berkel.1980(AT)gmail.com), Aug 06 2009
EXTENSIONS
a(4) corrected by Nathaniel Johnston, Jan 10 2014
STATUS
approved