login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
OFFSET
0,4
LINKS
J. H. Conway, On Happy Factorizations, J. Integer Sequences, Vol. 1, 1998, #1.
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
KEYWORD
nonn
AUTHOR
STATUS
approved

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy