This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A173500 #18 May 12 2023 23:17:11 %S A173500 0,0,0,6,64,854,13392,244944,5124266,120795956,3169804000,91666666668, %T A173500 2897010809280,99350833566282,3674884626652666,145845089585448960, %U A173500 6182031393612132352,278750799336055446646,13322922112485213149376 %N A173500 Number of sequences of length n with terms from {0,1,...,n-1} such that the sum of terms is 0 modulo n and the i-th term is not i or 2i modulo n. %H A173500 Robert Israel, <a href="/A173500/b173500.txt">Table of n, a(n) for n = 1..200</a> %H A173500 Art of Problem Solving forum, <a href="https://artofproblemsolving.com/community/c6h31946">45th IMO Team Selection Test Lincoln, Nebraska</a>. %F A173500 For prime p, a(p) = (p-1)*((p-2)^(p-1)-1)/p. %e A173500 For n=4 the a(4)=6 sequences are 0103, 0112, 0301, 3113, 3302 and 3311. - _Robert Israel_, Aug 30 2020 %p A173500 f:= proc(n) %p A173500 local g; %p A173500 g:= proc(i,s) option remember; %p A173500 if i = 0 then if s=0 then return 1 else return 0 fi fi; %p A173500 add(procname(i-1,s-k mod n),k= {$0..n-1} minus {2*i mod n,i}) %p A173500 end proc; %p A173500 g(n,0) %p A173500 end proc: %p A173500 map(f, [$1..30]); # _Robert Israel_, Aug 30 2020 %t A173500 f[n_] := Module[{g}, g[i_, s_] := g[i, s] = With[{}, If[i == 0, If[s == 0, Return@1, Return@0]]; Sum[g[i-1, Mod[s-k, n]], {k, Range[0, n-1] ~Complement~ {Mod[2i, n], i}}]]; g[n, 0]]; %t A173500 Table[f[n], {n, 1, 30}] (* _Jean-François Alcover_, May 11 2023, after _Robert Israel_ *) %Y A173500 Cf. A173499. %K A173500 nonn %O A173500 1,4 %A A173500 _Max Alekseyev_, Feb 20 2010