login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 2
0, 0, 0, 6, 64, 854, 13392, 244944, 5124266, 120795956, 3169804000, 91666666668, 2897010809280, 99350833566282, 3674884626652666, 145845089585448960, 6182031393612132352, 278750799336055446646, 13322922112485213149376 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
LINKS
Art of Problem Solving forum, 45th IMO Team Selection Test Lincoln, Nebraska.
FORMULA
For prime p, a(p) = (p-1)*((p-2)^(p-1)-1)/p.
EXAMPLE
For n=4 the a(4)=6 sequences are 0103, 0112, 0301, 3113, 3302 and 3311. - Robert Israel, Aug 30 2020
MAPLE
f:= proc(n)
local g;
g:= proc(i, s) option remember;
if i = 0 then if s=0 then return 1 else return 0 fi fi;
add(procname(i-1, s-k mod n), k= {$0..n-1} minus {2*i mod n, i})
end proc;
g(n, 0)
end proc:
map(f, [$1..30]); # Robert Israel, Aug 30 2020
MATHEMATICA
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]];
Table[f[n], {n, 1, 30}] (* Jean-François Alcover, May 11 2023, after Robert Israel *)
CROSSREFS
Cf. A173499.
Sequence in context: A239847 A264634 A296165 * A141008 A336114 A354494
KEYWORD
nonn
AUTHOR
Max Alekseyev, Feb 20 2010
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 18 22:56 EDT 2024. Contains 370952 sequences. (Running on oeis4.)