login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A007968 Type of happy factorization of n. 12
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..300

J. H. Conway, On Happy Factorizations, J. Integer Sequences, Vol. 1, 1998, #1.

Reinhard Zumkeller, Initial Happy Factorization Data for n <= 250

FORMULA

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

PROG

(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

CROSSREFS

Cf. A000290, A007969, A007970.

Sequence in context: A339823 A127506 A353433 * A236532 A077763 A030218

Adjacent sequences:  A007965 A007966 A007967 * A007969 A007970 A007971

KEYWORD

nonn

AUTHOR

J. H. Conway

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 23 13:43 EDT 2022. Contains 357689 sequences. (Running on oeis4.)