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.

A007968 Type of happy factorization of n.

Original entry on oeis.org

0, 0, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 1, 1, 1, 2, 0, 1, 1, 2, 1, 1, 1, 2, 2, 0, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 0, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 0, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 0, 1, 1, 2, 2
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a007968 = (\(hType,,,_,_) -> hType) . h
    h 0 = (0, 0, 0, 0, 0)
    h x = if a > 0 then (0, a, a, a, a) else h' 1 divs
          where a = a037213 x
                divs = a027750_row x
                h' r []                                = h' (r + 1) divs
                h' r (d:ds)
                 | d' > 1 && rest1 == 0 && ss == s ^ 2 = (1, d, d', r, s)
                 | rest2 == 0 && odd u && uu == u ^ 2  = (2, d, d', t, u)
                 | otherwise                           = h' r ds
                 where (ss, rest1) = divMod (d * r ^ 2 + 1) d'
                       (uu, rest2) = divMod (d * t ^ 2 + 2) d'
                       s = a000196 ss; u = a000196 uu; t = 2 * r - 1
                       d' = div x d
    hs = map h [0..]
    hCouples = map (\(, factor1, factor2, , _) -> (factor1, factor2)) hs
    sqrtPair n = genericIndex sqrtPairs (n - 1)
    sqrtPairs = map (\(, , _, sqrt1, sqrt2) -> (sqrt1, sqrt2)) hs
    -- Reinhard Zumkeller, Oct 11 2015

Formula

a(A000290(n)) = 0; a(A007969(n)) = 1; a(A007970(n)) = 2.