fork download
  1. f=lambda n:(2+f(n/10)if n%10==9else 26523308>>n%10*3&7)if n else 2
  2.  
  3. print f(1999) == 11
  4. print f(12345) == 1
  5. print f(999999) == 14
  6. print f(5699999) == 15
  7. print f(8765210248) == 1
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
True
True
True
True
True