Dense Number Sequence

Jelly, 9 bytes

ÆE²Sḍ2µ#Ṫ

Reads from STDIN and uses 1-based indexing. Try it online!

How it works

ÆE²Sḍ2µ#Ṫ  Main link. No arguments. Implicit argument: 0

      µ#   Read an integer n from STDIN and execute the chain to the left for
           k = 0, 1, 2, ... until n of them return a truthy value.
           Return the array of matches.
ÆE           Compute the exponents of k's prime factorization.
  ²          Square each exponent.
   S         Compute the sum of all squares.
    ḍ2       Test if 2 is divisible by the result (true iff  the sum is 1 or 2).
        Ṫ  Tail; extract the last (n-th) matching value of k.