login
A163889
Number of unlock patterns of length n for the Android operating system.
0
1, 9, 56, 320, 1624, 7152, 26016, 72912, 140704, 140704
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
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
Sequence in context: A026879 A026863 A026890 * A296817 A034362 A037711
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