R/tern2int.R

# tern vector of 0/1/2
# int integer
tern2int<-function(tern)
{
  n<-length(tern);
  dec<-0
  for (k in 0:(n-1))
    dec<-dec+tern[n-k]*3^k
  dec

}

Try the prefmod package in your browser

Any scripts or data that you put into this service are public.

prefmod documentation built on May 2, 2019, 4:59 p.m.