A329243 a(n) = Pi(8,3)(prime(n)) + Pi(8,5)(prime(n)) + Pi(8,7)(prime(n)) - 3*Pi(8,1)(prime(n)), where Pi(a,b)(x) denotes the number of primes in the arithmetic progression a*k + b less than or equal to x.
0, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 9, 10, 11, 8, 9, 10, 7, 4, 5, 6, 7, 8, 5, 6, 7, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 11, 12, 13, 14, 15, 16, 17, 14, 15, 12, 13, 10, 11, 12, 13, 14, 11, 12, 13, 14, 15, 12, 13, 14, 11, 12, 13, 10, 11, 12, 13, 14, 15, 16
Offset: 1
Keywords
Examples
For prime(25) = 97, there are 5 primes <= 97 that are congruent to 1 mod 8 (17, 41, 73, 89, 97), 7 primes congruent to 3 mod 8 (3, 11, 19, 43, 59, 67, 83), 6 primes congruent to 5 mod 8 (5, 13, 29, 37, 53, 61), 6 primes congruent to 7 mod 8 (7, 23, 31, 47, 71, 79), so a(25) = 7 + 6 + 6 - 3*5 = 4.
Links
- Jianing Song, Table of n, a(n) for n = 1..10000
Programs
-
PARI
a(n) = my(k=0); forprime(p=3, prime(n), if(p%8==1, k-=3, k++)); k
Extensions
Edited by Peter Munn, Nov 19 2023
Comments