A095100 Integers m of the form 4k+3 for which all sums Sum_{i=1..u} J(i/m) (with u ranging from 1 to (m-1)) are nonnegative, where J(i/m) is Jacobi symbol of i and m.
3, 7, 11, 15, 23, 27, 31, 35, 39, 47, 55, 59, 63, 71, 75, 79, 83, 87, 95, 103, 111, 119, 131, 135, 143, 151, 159, 167, 171, 175, 183, 191, 199, 215, 231, 239, 243, 251, 255, 263, 271, 279, 287, 295, 299, 303, 311, 319, 327, 335, 343, 351, 359, 363
Offset: 1
Keywords
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
- Antti Karttunen and J. Moyer, C-program for computing the initial terms of this sequence
Programs
-
Mathematica
isMotzkin[n_, k_] := Module[{s = 0, r = True}, Do[s += JacobiSymbol[i, n]; If[s < 0, r = False; Break[]], {i, 1, k}]; r]; A095100[n_] := Select[4*Range[0, n+1]+3, isMotzkin[#, Quotient[#, 2]] &]; A095100[90] (* Jean-François Alcover, Oct 08 2013, translated from Sage *)
-
PARI
isok(m) = {if(m%4<3, return(0)); my(s=0); for(i=1, m-1, if((s+=kronecker(i, m))<0, return(0))); 1; } \\ Jinyuan Wang, Jul 20 2020
-
Sage
def is_Motzkin(n, k): s = 0 for i in range(1, k + 1) : s += jacobi_symbol(i, n) if s < 0: return False return True def A095100_list(n): return [m for m in range(3, n + 1, 4) if is_Motzkin(m, m // 2)] A095100_list(363) # Peter Luschny, Aug 08 2012
Formula
a(n) = 4*A095274(n) + 3.
Comments