Quantcast
Channel: All about basic binary - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 23

Answer by MickyT for All about basic binary

$
0
0

R, 111

Probably a lot of room to improve this at the moment

i=scan();b=2:i;R=i%%b;I=rep(i,i-1);while(any(I<-I%/%b))R=cbind(I%%b,R);for(x in b)if(all(R[x-1,]<2))cat(x,'\n')

Runs with warnings

> i=scan();b=2:i;R=i%%b;I=rep(i,i-1);while(any(I<-I%/%b))R=cbind(I%%b,R);for(x in b)if(all(R[x-1,]<2))cat(x,'\n')1: 820002: Read 1 itemThere were 17 warnings (use warnings() to see them)2 3 4 5 81999 82000>

Viewing all articles
Browse latest Browse all 23

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>