OFFSET
1,7
COMMENTS
FORMULA
PROG
(Scheme)
(define (A258204 n) (let loop ((k (+ 1 (expt 2 (+ n n)))) (c 0)) (cond ((pow2? k) c) (else (loop (+ 1 k) (+ c (if (isA258003? k) 1 0)))))))
(define (pow2? n) (let loop ((n n) (i 0)) (cond ((zero? n) #f) ((odd? n) (and (= 1 n) i)) (else (loop (/ n 2) (1+ i)))))) ;; Gives non-false only when n is a power of two.
;; Code for isA258003? given in A258003.
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Antti Karttunen, May 31 2015
STATUS
approved