R/tern2int.R

Defines functions tern2int

# 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 June 11, 2022, 3 p.m.