In this paper, we introduce novel algorithms to solve projected answer set counting (#PAs). #PAs asks to count the number of answer sets with respect to a given set of projected atoms, where multiple answer sets that are identical when restricted to the projected atoms count as only one projected answer set. Our algorithms exploit small treewidth of the primal graph of the input instance by dynamic programming (DP).We establish a new algorithm for head-cycle-free (HCF) programs and lift very recent results from projected model counting to #PAs when the input is restricted to HCF programs. Further, we show how established DP algorithms for tight, normal, and disjunctive answer set programs can be extended to solve #PAs. Our algorithms run in polynomial time while requiring double exponential time in the treewidth for tight, normal, and HCF programs, and triple exponential time for disjunctive programs.Finally, we take the exponential time hypothesis (ETH) into account and establish lower bounds of bounded treewidth algorithms for #PAs. Under ETH, one cannot significantly improve our obtained worst-case runtimes. * This work extends an abstract [18] explaining only concepts, and a preliminary workshop paper [17], and has beento count the answer sets of a disjunctive program with respect to a given set of projected atoms (#PAs). Particularly, multiple answer sets that are identical when reduced to the projected atoms are considered as only one solution. Intuitively, #PAs is needed to count answer sets without counting functionally independent auxiliary atoms. Under standard assumptions the problem #PAs is complete for the class #·Σ 2 P . However, if we take all atoms as projected, then #PAs is again #·coNP-complete and if there are no projected atoms then it is simply Σ p 2 -complete. But some fragments of ASP have lower complexity. A prominent example is the class of head-cycle-free (HCF) programs [4], which requires the absence of cycles in a certain graph representation of the program. Deciding whether a HCF program has an answer set is NP-complete.A way to solve computationally hard problems is to employ parameterized algorithmics [12], which exploits certain structural restrictions in a given input instance. Because structural properties of an input instance often allow for algorithms that solve problems in polynomial time in the size of the input and exponential time in a measure of the structure, whereas under standard assumptions an efficient algorithm is not possible if we consider only the size of the input. In this paper, we consider the treewidth of a graph representation associated with the given input program as structural restriction, namely the treewidth of the primal graph [30]. Generally speaking, treewidth 1 measures the closeness of a graph to a tree, based on the observation that problems on trees are often easier to solve than on arbitrary graphs.Our results are as follows: We establish the classical complexity of #PAs and a novel algorithm that solves ASP problems by exploiting treewidth when ...