A366502 Let q = A246655(n) for n >= 2, then a(n) = (q - Kronecker(-4,q))/4 - 1.
0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 11, 12, 14, 14, 15, 16, 17, 17, 19, 19, 20, 21, 23, 24, 25, 26, 26, 27, 29, 30, 31, 31, 32, 33, 34, 36, 37, 38, 40, 41, 41, 42, 44, 44, 47, 47, 48, 49, 52
Offset: 2
Examples
a(5) = 1 because there is one pair of consecutive nonzero squares in the finite field F_q with q = A246655(5) = 7, namely {1, 2}. a(7) = 1 because there is one pair of consecutive nonzero squares in the finite field F_q with q = A246655(7) = 9, namely {1, 2} (note that 2 = -1 = i^2 in F_9 = F_3(i)).
Links
- Jianing Song, Table of n, a(n) for n = 2..10000
- Mathematics Stack Exchange, Existence of Consecutive Quadratic residues.
Crossrefs
Programs
-
PARI
lim_A366502(N) = for(n=3, N, if(isprimepower(n), print1((n - kronecker(-4,n))/4 - 1, ", ")))
-
Python
from sympy import primepi, integer_nthroot, kronecker_symbol def A366502(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return int(n+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length()))) return ((m:=bisection(f,n,n))-kronecker_symbol(-4,m)>>2)-1 # Chai Wah Wu, Jan 19 2025
Comments