OFFSET
1,1
COMMENTS
PROG
(MIT Scheme with macro MATCHING-POS by AK):
(define index_for_a166051 (MATCHING-POS 1 0 (lambda (n) (let ((w (A016813c n)) (hp (A005843 n))) (let loop ((i 1) (s 1)) (cond ((< s 0) #f) ((>= i hp) (zero? s)) (else (loop (1+ i) (+ s (jacobi-symbol (1+ i) w))))))))))
(Sage)
def is_what(n, k):
s = 0
for i in (1..k):
s += jacobi_symbol(i, n)
if s < 0: return False
return not is_square(n)
def A166051_list(n):
return [m for m in range(1, n + 1, 4) if is_what(m, m // 2)]
A166051_list(1000) # Peter Luschny, Aug 08 2012
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Oct 08 2009
STATUS
approved