OFFSET
1,2
COMMENTS
LINKS
EXAMPLE
9 ("1001" in binary) encodes polynomial X^3 + 1, which is factored over GF(2) as (X+1)(X^2 + X + 1), where polynomial X + 1 is encoded by 3 ("11" in binary), and polynomial X^2 + X + 1 by 7 ("111" in binary), and furthermore (like all polynomials) it is also divisible by 1 and itself, thus a(9) = 1 + 3 + 7 + 9 = 20.
PROG
(Scheme)
(define (A280493 n) (let loop ((k n) (s 0)) (if (zero? k) s (loop (- k 1) (+ s (if (= k (A091255bi n k)) k 0))))))
;; A091255bi implements the 2-argument GF(2)[X] GCD-function (A091255) which is used for checking that k is a divisor of n.
;; Another version:
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (+ 1 i) (+ res (intfun i)))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jan 09 2017
STATUS
approved