cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Masahiko Shin, Feb 12 2018

Keywords

Comments

First differs from A000040 at a(47)=210.

Examples

			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.
		

Crossrefs

Subsequence of A005117.

Programs

  • 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 *)
  • 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
  • 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))