Here you will find daily news and tutorials about R, contributed by over 750 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)

A “powerful integer” is such that all its prime divisors are at least with multiplicity 2. Are there two powerful integers in a row, i.e. such that both n and n+1 are powerful?

Are there odd integers n such that n² – 1 is a powerful integer ?

The first question can be solved by brute force. Here is a R code that leads to the solution:

isperfz <- function(n){
divz=primeFactors(n)
facz=unique(divz)
ordz=rep(0,length(facz))
for (i in 1:length(facz))
ordz[i]=sum(divz==facz[i])
return(min(ordz)>1)}
lesperf=NULL
for (t in 4:1e5)
if (isperfz(t)) lesperf=c(lesperf,t)
twinz=lesperf[diff(lesperf)==1]

with solutions 8, 288, 675, 9800, 12167.

The second puzzle means rerunning the code only on integers n²-1…

except that I cannot exceed n²=10⁸. (The Le Monde puzzles will now stop for a month, just like about everything in France!, and then a new challenge will take place. Stay tuned.)

Related

To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og.