login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers n divisible by precprime(sqrt(n)) or nextprime(sqrt(n)) but not both, where precprime=A007917, nextprime=A007918.
1

%I #8 Feb 21 2020 20:12:39

%S 8,10,12,18,20,21,24,28,30,40,42,45,55,56,63,66,70,84,88,91,98,99,105,

%T 110,112,119,130,132,154,156,165,170,182,187,195,204,208,234,238,247,

%U 255,260,272,273,286,304,306,340,342,357,368,380,391,399,414,418,456

%N Numbers n divisible by precprime(sqrt(n)) or nextprime(sqrt(n)) but not both, where precprime=A007917, nextprime=A007918.

%C Equal to the union of its disjoint subsequences A157938 and A157940.

%H Project Euler, <a href="https://projecteuler.net/index.php?section=problems&amp;id=234">Problem 234: Semidivisible numbers</a>, Feb 28 2009

%F A157939 = A157938 union A157940 = A157937 /\ A157941 = A157936 /\ A157942, where A /\ B = (A u B) \ (A n B) = (A \ B) u (B \ A) is the symmetric difference; A157937 intersect A157941 = A006094 = (A157936 intersect A157942) \ A001248.

%e 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)).

%e a(2) = 10 is divisible by 5=nextprime(sqrt(10)) but not by 3=precprime(sqrt(8)).

%e 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)).

%t 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 *)

%o (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 */

%K nonn

%O 1,1

%A _M. F. Hasler_, Mar 10 2009