File: phi_vector.hpp

package info (click to toggle)
primecount 7.16%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,724 kB
  • sloc: cpp: 18,769; ansic: 102; makefile: 89; sh: 86
file content (41 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
///
/// @file  phi_vector.hpp
///
/// Copyright (C) 2024 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#ifndef PHI_VECTOR_HPP
#define PHI_VECTOR_HPP

#include <PiTable.hpp>
#include <Vector.hpp>
#include <stdint.h>

namespace primecount {

/// Returns a vector with phi(x, i - 1) values such that
/// phi[i] = phi(x, i - 1) for 1 <= i <= a.
/// phi(x, a) counts the numbers <= x that are not
/// divisible by any of the first a primes.
///
Vector<int64_t> phi_vector(int64_t x,
                           int64_t a,
                           const Vector<uint32_t>& primes,
                           const PiTable& pi);

/// Returns a vector with phi(x, i - 1) values such that
/// phi[i] = phi(x, i - 1) for 1 <= i <= a.
/// phi(x, a) counts the numbers <= x that are not
/// divisible by any of the first a primes.
///
Vector<int64_t> phi_vector(int64_t x,
                           int64_t a,
                           const Vector<int64_t>& primes,
                           const PiTable& pi);

} // namespace

#endif