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.

A218578 The number of times n occurs in A095972.

Original entry on oeis.org

2, 1, 3, 1, 1, 3, 2, 0, 2, 2, 2, 1, 2, 1, 3, 1, 2, 0, 4, 0, 2, 2, 1, 2, 0, 2, 2, 1, 3, 1, 2, 1, 2, 3, 0, 1, 2, 2, 1, 1, 2, 1, 2, 0, 3, 1, 2, 1, 2, 0, 4, 1, 2, 3, 2, 0, 2, 1, 2, 0, 2, 1, 0, 2, 0, 3, 3, 0, 4, 1, 2, 0, 2, 1, 3, 2, 0, 0, 3, 1, 0, 3, 2, 3, 0, 1, 3
Offset: 0

Views

Author

Dmitri Kamenetsky, Nov 03 2012

Keywords

Comments

Alternative definition: a(n) = number of k such that A000224(k) = k - n.

Examples

			a(0) is 2, because 0 occurs only twice in A095972. a(1) is 1, because 1 occurs only once in A095972.
		

Crossrefs

Cf. A000224, A095972, A218620 (greedy inverse).

Programs

  • Maple
    A218578 := proc(n)
        local f;
        f := 0 ;
        for q from 1 to 2*n+2 do
            if A095972(q) = n then
                f := f+1 ;
            end if;
        end do:
        f ;
    end proc: # R. J. Mathar, Nov 05 2012
  • Mathematica
    nn = 100; t = Table[Length[Complement[Range[n-1], Union[Mod[Range[n]^2, n]]]], {n, 2*nn + 2}]; Table[Count[t, n], {n, 0, nn}] (* T. D. Noe, Nov 06 2012 *)
  • Python
    from math import prod
    from sympy import factorint
    def A218578(n): return sum(1 for i in range(1,2*n+3) if n==i-prod((p**(e+1)//((p+1)*(q:=1+(p==2)))>>1)+q for p, e in factorint(i).items())) # Chai Wah Wu, Oct 07 2024