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.

This page as a plain text file.
%I A007968 #24 Nov 09 2015 05:26:34
%S A007968 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,
%T A007968 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,
%U A007968 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
%N A007968 Type of happy factorization of n.
%H A007968 Reinhard Zumkeller, <a href="/A007968/b007968.txt">Table of n, a(n) for n = 0..300</a>
%H A007968 J. H. Conway, <a href="http://www.cs.uwaterloo.ca/journals/JIS/happy.html">On Happy Factorizations</a>, J. Integer Sequences, Vol. 1, 1998, #1.
%H A007968 Reinhard Zumkeller, <a href="/A007968/a007968.txt">Initial Happy Factorization Data for n <= 250</a>
%F A007968  a(A000290(n)) = 0; a(A007969(n)) = 1; a(A007970(n)) = 2.
%o A007968 (Haskell)
%o A007968 a007968 = (\(hType,_,_,_,_) -> hType) . h
%o A007968 h 0 = (0, 0, 0, 0, 0)
%o A007968 h x = if a > 0 then (0, a, a, a, a) else h' 1 divs
%o A007968       where a = a037213 x
%o A007968             divs = a027750_row x
%o A007968             h' r []                                = h' (r + 1) divs
%o A007968             h' r (d:ds)
%o A007968              | d' > 1 && rest1 == 0 && ss == s ^ 2 = (1, d, d', r, s)
%o A007968              | rest2 == 0 && odd u && uu == u ^ 2  = (2, d, d', t, u)
%o A007968              | otherwise                           = h' r ds
%o A007968              where (ss, rest1) = divMod (d * r ^ 2 + 1) d'
%o A007968                    (uu, rest2) = divMod (d * t ^ 2 + 2) d'
%o A007968                    s = a000196 ss; u = a000196 uu; t = 2 * r - 1
%o A007968                    d' = div x d
%o A007968 hs = map h [0..]
%o A007968 hCouples = map (\(_, factor1, factor2, _, _) -> (factor1, factor2)) hs
%o A007968 sqrtPair n = genericIndex sqrtPairs (n - 1)
%o A007968 sqrtPairs = map (\(_, _, _, sqrt1, sqrt2) -> (sqrt1, sqrt2)) hs
%o A007968 -- _Reinhard Zumkeller_, Oct 11 2015
%Y A007968 Cf. A000290, A007969, A007970.
%K A007968 nonn
%O A007968 0,4
%A A007968 _J. H. Conway_