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.

A178921 Product of distances between successive distinct prime divisors of n; zero if n has only 1 distinct prime factor.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 1, 0, 5, 2, 0, 0, 1, 0, 3, 4, 9, 0, 1, 0, 11, 0, 5, 0, 2, 0, 0, 8, 15, 2, 1, 0, 17, 10, 3, 0, 4, 0, 9, 2, 21, 0, 1, 0, 3, 14, 11, 0, 1, 6, 5, 16, 27, 0, 2, 0, 29, 4, 0, 8, 8, 0, 15, 20, 6, 0, 1, 0, 35, 2, 17, 4, 10, 0, 3, 0, 39, 0, 4, 12, 41, 26, 9, 0, 2, 6, 21, 28, 45, 14, 1, 0, 5, 8, 3, 0, 14, 0, 11
Offset: 1

Views

Author

Alex Ratushnyak, Aug 18 2012

Keywords

Comments

For n <= 41, a(n) = A049087(n).

Crossrefs

Cf. also A137795.

Programs

  • Mathematica
    f[n_] := Module[{ps}, If[n <= 1, 0, ps = Transpose[FactorInteger[n]][[1]]; Times @@ Differences[ps]]]; Table[f[n], {n, 100}] (* T. D. Noe, Aug 20 2012 *)
    Array[Apply[Times, Differences@ FactorInteger[#][[All, 1]] /. {} -> 0] &, 105] (* Michael De Vlieger, Sep 10 2018 *)
  • PARI
    A178921(n) = if(1>=omega(n), 0, my(ps = factor(n)[,1], m = 1); for(i=2, #ps, m *= (ps[i]-ps[i-1])); (m)); \\ Antti Karttunen, Sep 07 2018
  • Python
    from sympy import primerange
    primes = list(primerange(2,500))
    for n in range(1,100):
        d = n
        prev = 0
        product = 1
        for p in primes:
            if d%p==0:
                if prev:
                    product *= p-prev
                while d%p==0:
                    d//=p
                if d==1:
                    break
                prev = p
        if prev==0:
            product = 0
        print(product, end=',')
    

Extensions

More terms from Antti Karttunen, Sep 07 2018