Thread: Primes of the form n+-phi(n) View Single Post
 2017-01-26, 01:19 #2 Batalov     "Serge" Mar 2008 Phi(4,2^7658614+1)/2 2·33·132 Posts Do you want both prime? Then n must be odd (and composite) and ... (this is https://oeis.org/A068081 ) Code: ? forstep(n=1,1000,2,p=eulerphi(n);if(isprime(n-p),if(isprime(n+p),print(n" +-"p" "n-p" "n+p)))) 15 +-8 7 23 33 +-20 13 53 35 +-24 11 59 51 +-32 19 83 65 +-48 17 113 77 +-60 17 137 91 +-72 19 163 95 +-72 23 167 143 +-120 23 263 161 +-132 29 293 177 +-116 61 293 209 +-180 29 389 213 +-140 73 353 215 +-168 47 383 217 +-180 37 397 247 +-216 31 463 255 +-128 127 383 303 +-200 103 503 335 +-264 71 599 341 +-300 41 641 371 +-312 59 683 411 +-272 139 683 427 +-360 67 787 435 +-224 211 659 447 +-296 151 743 455 +-288 167 743 533 +-480 53 1013 545 +-432 113 977 561 +-320 241 881 573 +-380 193 953 591 +-392 199 983 611 +-552 59 1163 665 +-432 233 1097 707 +-600 107 1307 713 +-660 53 1373 717 +-476 241 1193 779 +-720 59 1499 803 +-720 83 1523 871 +-792 79 1663 917 +-780 137 1697 933 +-620 313 1553 965 +-768 197 1733 Download and learn a few things about Pari/GP and you will be all set for many similar questions. If you want "or" and want to find them faster than using phi, then: One simple subset is: For n prime, phi(n)=n-1 => n-phi(n) is 1 (not prime) but 2*n-1 will be frequently prime. Last fiddled with by Batalov on 2017-01-26 at 01:21