[go: up one dir, main page]

login
A295425
a(n) = smallest number > a(n-1) such that the number of preceding terms in the sequence dividing a(n) is divisible by 4; a(1) = 2.
0
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 210, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 330, 331
OFFSET
1,1
COMMENTS
First differs from A000040 at a(47)=210.
EXAMPLE
3 is in the sequence because no preceding terms (i.e., 0 terms) divide it and 0 is divisible by 4.
4 is not in the sequence because there is only 1 term (i.e., a(1) = 2) that divides it and 1 is not divisible by 4.
MATHEMATICA
With[{k = 4}, Nest[Append[#, SelectFirst[Range[#[[-1]] + 1, #[[-1]] + 120], Function[n, Divisible[Count[#, _?(Divisible[n, #] &)], k]]]] &, {2}, 68]] (* Michael De Vlieger, Feb 15 2018 *)
PROG
(Python)
import math
def getSeq(n):
....if n == 1:
........return [2]
....prev = getSeq(n-1)
....cand = max(prev)
....while True:
........cand += 1
........if len( [n for n in prev if cand % n == 0] ) % 4 == 0:
............prev.append(cand)
............return prev
print(getSeq(100))
(PARI) isok(k, va, nb) = (sum(j=1, nb, !(k % va[j])) % 4) == 0;
lista(nn) = {va = vector(nn); va[1] = 2; for (n=2, nn, k = va[n-1]+1; while (! isok(k, va, n-1), k++); va[n] = k; ); va; } \\ Michel Marcus, Mar 01 2018
CROSSREFS
Subsequence of A005117.
Sequence in context: A055398 A070159 A322394 * A158611 A226159 A182986
KEYWORD
nonn,easy
AUTHOR
Masahiko Shin, Feb 12 2018
STATUS
approved