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
KEYWORD
nonn,easy
AUTHOR
Masahiko Shin, Feb 12 2018
STATUS
approved