Skip to content

Instantly share code, notes, and snippets.

@jack980517
Last active June 24, 2020 03:52
Show Gist options
  • Save jack980517/e903cddfb9e0c6c59c82bcab2d009f28 to your computer and use it in GitHub Desktop.
Save jack980517/e903cddfb9e0c6c59c82bcab2d009f28 to your computer and use it in GitHub Desktop.
#!python2
#n=denominator
#b=base
#pfn=prime_factors_of(n)
#pfb=prime_factors_of(b)
pfn=[2,5,2,5,3,5]
pfb=[2,5]
pure_recurring=False
recurring=False
if not set(pfn)&set(pfb):
pure_recurring=True
recurring=True
if not pure_recurring:
for i in pfn:
if i not in pfb:
recurring=True
break
length_of_not_recurring_part=0
if recurring and not pure_recurring:
length_of_not_recurring_part=max([pfn.count(_) for _ in set(pfb)])
print recurring,pure_recurring,length_of_not_recurring_part
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment