This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A007968 Type of happy factorization of n. 12

%I

%S 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 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 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 Type of happy factorization of n.

%H Reinhard Zumkeller, <a href="/A007968/b007968.txt">Table of n, a(n) for n = 0..300</a>

%H 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 Reinhard Zumkeller, <a href="/A007968/a007968.txt">Initial Happy Factorization Data for n <= 250</a>

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

%o a007968 = (\(hType,_,_,_,_) -> hType) . h

%o h 0 = (0, 0, 0, 0, 0)

%o h x = if a > 0 then (0, a, a, a, a) else h' 1 divs

%o where a = a037213 x

%o divs = a027750_row x

%o h' r [] = h' (r + 1) divs

%o h' r (d:ds)

%o | d' > 1 && rest1 == 0 && ss == s ^ 2 = (1, d, d', r, s)

%o | rest2 == 0 && odd u && uu == u ^ 2 = (2, d, d', t, u)

%o | otherwise = h' r ds

%o where (ss, rest1) = divMod (d * r ^ 2 + 1) d'

%o (uu, rest2) = divMod (d * t ^ 2 + 2) d'

%o s = a000196 ss; u = a000196 uu; t = 2 * r - 1

%o d' = div x d

%o hs = map h [0..]

%o hCouples = map (\(_, factor1, factor2, _, _) -> (factor1, factor2)) hs

%o sqrtPair n = genericIndex sqrtPairs (n - 1)

%o sqrtPairs = map (\(_, _, _, sqrt1, sqrt2) -> (sqrt1, sqrt2)) hs

%o -- _Reinhard Zumkeller_, Oct 11 2015

%Y Cf. A000290, A007969, A007970.

%K nonn

%O 0,4

%A _J. H. Conway_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified October 18 23:07 EDT 2018. Contains 316327 sequences. (Running on oeis4.)