Question about repeating decimal? For simple fraction, we can easily convert it to repeating decimal by calculator. Ex. $\frac 1 3 = 0.33333\ldots$, $\frac 1 7=0.(142857),\ldots$ But some fraction fraction like $10/29, 1/97,...$ The repeating part of them are too long, so it can't fully show on the calculator. So is there any algorithm  to find the repeating part for that fraction?
 A: Yes, there is. This wikipedia page explains the various algorithms in the Section "Converting repeating decimals to fractions".
A: Yes. Here is one I once wrote in the R language.
It uses the 'gmp' (GNU Multiple Precision) package.
#########################################################
### Functions for converting back and forth between   ###
### rational numbers and decimals. Repeating decimals ###
### are denoted by brackets around the digit block    ###
### repeats. For example, 11/6 is 1.8[3] in decimal.  ###
#########################################################

#############################
### Author: Roman Chokler ###
#############################
library(gmp)

bigq.to.dec <- function(q)
{
  sgn <- sign(q)
  num <- abs(numerator(q))
  den <- denominator(q)
  d <- den
  c2 <- 0
  c5 <- 0
  while(d %% 2==0)
  {
    d <- as.bigz(d/2)
    c2 <- c2 + 1
  }
  while(d %% 5==0)
  {
    d <- as.bigz(d/5)
    c5 <- c5 + 1
  }
  transient <- max(c2,c5)
  dec <- as.character(as.bigz(num/den))
  rem <- num %% den
  if (rem != 0)
  {
    dec <- paste0(dec,".")
    if (transient>0)
    {
      for(i in 1:transient)
      {
        rem <- rem * 10
        dec <- paste0(dec,as.bigz(rem/den))
        rem <- rem %% den
      }
    }
    if (rem != 0)
    {
      dec <- paste0(dec,"[")
      r <- rem
      rem <- rem * 10
      dec <- paste0(dec,as.bigz(rem/den))
      rem <- rem %% den
      while (rem != r)
      {
        rem <- rem * 10
        dec <- paste0(dec,as.bigz(rem/den))
        rem <- rem %% den
      }
      dec <- paste0(dec,"]")
    }
  }
  if (sgn == -1)
  {
    dec <- paste0("-",dec)
  }
  return(dec)
}

dec.to.bigq <- function(dec)
{
  bq <- 0
  sgn <- 1
  n <- nchar(dec)
  if (regexpr("-",dec)[1]==1)
  {
    sgn <- -1
    dec <- substr(dec,2,n)
    n <- n - 1
  }
  pnt <- regexpr("\\.",dec)[1]
  rstart <- regexpr("\\[",dec)[1]
  rend <- regexpr("\\]",dec)[1]
  if (pnt == -1)
  {
    return(as.bigq(dec) * sgn)
  }
  if (n==pnt)
  {
    return((as.bigq(substr(dec,1,pnt-1))) * sgn)
  }
  bq <- as.bigq(substr(dec,1,pnt-1))
  if (rstart == -1)
  {
    transient <- substr(dec,pnt+1,n)
    den <- pow.bigz(10,nchar(transient))
    transient <- sub("^0+","",transient)
    if (transient == "")
    {
      transient <- "0"
    }
    return((bq + div.bigq(transient,den)) * sgn)
  }
  den <- as.bigz(1)
  if (rstart > pnt + 1)
  {
    transient <- substr(dec,pnt+1,rstart-1)
    den <- pow.bigz(10,nchar(transient))
    transient <- sub("^0+","",transient)
    if (transient == "")
    {
      transient <- "0"
    }
    bq <- bq + div.bigq(transient,den)
  }
  if ((rend == -1) || (rstart >= rend - 1) || n > rend)
  {
    return(as.bigq(NA))
  }
  rep <- substr(dec,rstart+1,rend-1)
  den <- den * (pow.bigz(10,nchar(rep)) - 1)
  rep <- sub("^0+","",rep)
  if (rep == "")
  {
    rep <- "0"
  }
  return((bq + div.bigq(rep,den)) * sgn)
}

