## Le Monde puzzle [#913]

**A**n arithmetics Le Monde mathematical puzzle:

Find all bi-twinintegers, namely positiveintegers such that adding 2 to any of their dividers returns a prime number.

An easy puzzle, once the R libraries on prime number decomposition can be found!, since it is straightforward to check for solutions. Unfortunately, I could not install the recent numbers package. So I used instead the schoolmath R package. Despite its possible bugs. But it seems to do the job for this problem:

lem=NULL for (t in 1:1e4) if (prod(is.prim(prime.factor(t)+2)==1)) lem=c(lem,t)digin=function(n){

which returned all solutions, albeit in a lengthy fashion:

> lem [1] 1 3 5 9 11 15 17 25 27 29 33 41 45 51 55 [16] 59 71 75 81 85 87 99 101 107 121 123 125 135 137 145 [31] 149 153 165 177 179 187 191 197 205 213 225 227 239 243 255 [46] 261 269 275 281 289 295 297 303 311 319 321 347 355 363 369 [61] 375 405 411 419 425 431 435 447 451 459 461 493 495 505 521 [76] 531 535 537 561 569 573 591 599 605 615 617 625 639 641 649 [91] 659 675 681 685 697 717 725 729 745 765 781 783 807 809 821 [106] 825 827 841 843 857 867 881 885 891 895 909 933 935 955 957 [121] 963 985 1003 1019 1025 1031 ...

June 12, 2015 at 12:03 pm

You can use the pracma package and its `isprime` and `factors` functions.