Skip to main content
added 4 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Python 3.5, 62 6161 59 bytes

f=lambda n,d,*rr=[0,0]:(0,0,0,*r[r[:1],*r3]+r).count(n)or f(10*n%d,d,*r,nr+[n])

Prints 1 for eventually periodic, 2 for purely periodic, and 34 for terminating.

Verify all test cases on repl.itrepl.it.

Python 3.5, 62 61 bytes

f=lambda n,d,*r:(0,0,0,*r[:1],*r).count(n)or f(10*n%d,d,*r,n)

Prints 1 for eventually periodic, 2 for purely periodic, and 3 for terminating.

Verify all test cases on repl.it.

Python, 62 61 59 bytes

f=lambda n,d,r=[0,0]:(r[:3]+r).count(n)or f(10*n%d,d,r+[n])

Prints 1 for eventually periodic, 2 for purely periodic, and 4 for terminating.

Verify all test cases on repl.it.

added 7 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Python 3.5, 6262 61 bytes

f=lambda n,d,*r:n in r and~(20,n==r[0]0,0,*r[:1],*r)[n>0]or.count(n)or f(10*n%d,d,*r,n)

Prints -31 for terminatingeventually periodic, -2 for purely periodic, and -13 for eventually peridicterminating.

Verify all test cases on repl.itrepl.it.

Python 3.5, 62 bytes

f=lambda n,d,*r:n in r and~(2,n==r[0])[n>0]or f(10*n%d,d,*r,n)

Prints -3 for terminating, -2 for purely periodic, and -1 for eventually peridic.

Verify all test cases on repl.it.

Python 3.5, 62 61 bytes

f=lambda n,d,*r:(0,0,0,*r[:1],*r).count(n)or f(10*n%d,d,*r,n)

Prints 1 for eventually periodic, 2 for purely periodic, and 3 for terminating.

Verify all test cases on repl.it.

Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Python 3.5, 62 bytes

f=lambda n,d,*r:n in r and~(2,n==r[0])[n>0]or f(10*n%d,d,*r,n)

Prints -3 for terminating, -2 for purely periodic, and -1 for eventually peridic.

Verify all test cases on repl.it.