Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

Define the symmetric of an integer as the integer obtained by inverting the order of its digits, eg 4321 is the symmetric of 1234. What are the numbers for which the square is equal to the symmetric of the square of the symmetric?

I first consulted stackexchange to find a convenient R function to create the symmetric:

int2digit=function(x){
as.numeric(sapply(sequence(nchar(x)),
function(y) substr(x, y, y)))}
digit2int=function(a){
as.numeric(paste(a,collapse=""))}
flip=function(x){
digit2int(rev(int2digit(x)))}

and then found that all integers but the multiples of 10 are symmetric! As can be found on a piece of paper (but took me more time with my left hand!)