# Current Status Data -- see article sieve <- function(n) { primes <- rep(TRUE, n) primes[1] <- FALSE last.prime <- 2 for(i in last.prime:floor(sqrt(n))) {primes[seq.int(2L*last.prime, n, last.prime)] <- FALSE last.prime <- last.prime + min(which(primes[(last.prime+1):n])) } return( list(yes=which(primes),no=which(!primes)) ) } GetCurrentStatusData = function(max.n) { x = sieve(max.n)$yes ; x n=length(x) y=sample(sieve(max.n)$no,n) ; y l = (x < y) L=sort(y[l]) ; n.l=length(L) R=sort(y[!l]) ; n.r=length(R) left =c(rep(0,n.l),R) right=c(L,rep(max.n+1,n.r)) time=c(L,R) ds=data.frame(left,right) ; return(ds) }