OFFSET
1,4
COMMENTS
Define [+] to be binary bitwise inclusive-OR and let [*] denote the shift-and-[+] product. ([+] is usually simply called OR.) Note that [*] is commutative, associative, and distributes over [+]. If x [*] y = z, we say x and y are [*]-divisors of z.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
EXAMPLE
14 has 5 [*]-divisors: 1, 2, 3, 6, 7, since for example 2 [*] 7 = 10 [*] 111 = 1110 OR 0000 = 1110; and 3 [*] 6 = 11 [*] 110 = 1100 OR 0110 = 1110.
PROG
(Haskell)
import Data.Bits (Bits, (.|.), shiftL, shiftR)
a066376 :: Int -> Int
a066376 n = length [d | d <- [1..n-1], any ((== n) . (orm d)) [1..n]] where
orm 1 v = v
orm u v = orm (shiftR u 1) (shiftL v 1) .|. if odd u then v else 0
-- Reinhard Zumkeller, Mar 01 2013
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Marc LeBrun, Dec 22 2001
EXTENSIONS
Edited by N. J. A. Sloane, Dec 13 2021
Name corrected by Sean A. Irvine, Oct 10 2023
STATUS
approved