OFFSET
1,2
COMMENTS
This sequence contains all the primes and prime powers. For those terms that are composite, see A166402. For those terms that are not powers of primes, see A166403.
Also, the sequence contains all the positive squares. - Ivan Neretin, Jan 12 2016
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
EXAMPLE
The divisors of 50 are 1,2,5,10,25,50. The middle two divisors are 5 and 10. Since 5 divides 10, then 50 is in this sequence.
MAPLE
filter:= proc(n) local a, b;
if issqr(n) then return true fi;
a, b:= selectremove(t -> (t^2 <= n), numtheory:-divisors(n));
min(b) mod max(a) = 0
end proc:
select(filter, [$1..1000]); # Robert Israel, Jan 13 2016
MATHEMATICA
Select[Range[174], Divisible[(d = Divisors[#])[[n = Floor[Length[d]/2 + 1]]], d[[-n]]] &] (* Ivan Neretin, Jan 12 2016 *)
PROG
(PARI) isok(n) = my(d = divisors(n), ld = if(n<2, 1, d[(length(d)+1)\2]), sd = d[length(d)\2+1]); sd % ld == 0; \\ adapted from A033676 & A033677; Michel Marcus, Jan 13 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Oct 13 2009
EXTENSIONS
More terms from Max Alekseyev, Feb 23 2010
STATUS
approved