OFFSET
1,2
LINKS
Nick Hobson, C program
EXAMPLE
The binary expansion of sqrt(2) is 1.0110101000001..(A004539) and at position 17, there are four 1's, framed by 0's, so a(4)=17.
PROG
(Python)
from itertools import count
from math import isqrt
def A084186(n):
a, b = 2, (1<<n+2)-1
c = (b>>1)^1
for k in count(1-n):
if isqrt(a)&b==c:
return k
a<<=2 # Chai Wah Wu, Jan 24 2024
(C) See Links section.
CROSSREFS
KEYWORD
base,nonn,hard
AUTHOR
Ralf Stephan, May 18 2003
EXTENSIONS
a(21)-a(29) from Chai Wah Wu, Jan 25 2024
a(30)-a(34) from Nick Hobson, Feb 15 2024
STATUS
approved