OFFSET
1,1
LINKS
Project Euler, Problem 234: Semidivisible numbers, Feb 28 2009
FORMULA
EXAMPLE
For n=1,2,3, precprime(sqrt(n)) is undefined, so these are not considered here. a(1) = 8 is divisible by 2=precprime(sqrt(8)) but not by 3=nextprime(sqrt(8)).
a(2) = 10 is divisible by 5=nextprime(sqrt(10)) but not by 3=precprime(sqrt(8)).
MATHEMATICA
ndQ[n_]:=Module[{s=Sqrt[n]}, Total[Boole[{Divisible[n, NextPrime[ s]], Divisible[ n, NextPrime[ s, -1]]}]]==1]; Select[Range[5, 500], ndQ] (* Harvey P. Dale, Mar 19 2019 *)
PROG
(PARI) for( n=4, 999, !(n % nextprime(sqrtint(n-1)+1)) != !(n % precprime(sqrtint(n))) & print1(n", ")) /* sqrtint(n-1)+1 avoids rounding errors but can be replaced by sqrt(n) for small n */
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Mar 10 2009
STATUS
approved