# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a007968 Showing 1-1 of 1 %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, Table of n, a(n) for n = 0..300 %H A007968 J. H. Conway, On Happy Factorizations, J. Integer Sequences, Vol. 1, 1998, #1. %H A007968 Reinhard Zumkeller, Initial Happy Factorization Data for n <= 250 %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_ # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE