A157939 Numbers n divisible by precprime(sqrt(n)) or nextprime(sqrt(n)) but not both, where precprime=A007917, nextprime=A007918.
8, 10, 12, 18, 20, 21, 24, 28, 30, 40, 42, 45, 55, 56, 63, 66, 70, 84, 88, 91, 98, 99, 105, 110, 112, 119, 130, 132, 154, 156, 165, 170, 182, 187, 195, 204, 208, 234, 238, 247, 255, 260, 272, 273, 286, 304, 306, 340, 342, 357, 368, 380, 391, 399, 414, 418, 456
Offset: 1
Keywords
Examples
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)). n=4,6,9,... are excluded since divisible by both precprime(sqrt(n)) and nextprime(sqrt(n)). (Note that precprime=A007917 and nextprime=A007918 are defined using weak inequalities.) n=5,7,11,13 but also 14 are excluded since not divisible by precprime(sqrt(n)) nor by nextprime(sqrt(n)).
Links
- Project Euler, Problem 234: Semidivisible numbers, Feb 28 2009
Programs
-
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 *)
-
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 */
Comments