The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A367546 a(n) = Sum_{k=0..n} n^k * |(n - k | k)|, where (a | b) denotes the Kronecker symbol. 3
0, 2, 2, 12, 68, 780, 7782, 137256, 2130440, 47895390, 1010001010, 28531167060, 743044451340, 25239592216020, 797785000011174, 31147773583410240, 1157442765409226768, 51702516367896047760, 2185932446972586391986, 109912203092239643840220, 5255987282125313280008020 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
Wikipedia, Kronecker symbol
FORMULA
a(n) = Sum_{k=0..n} [gcd(k, n) = 1] * n^k, where [] is the Iverson bracket.
MAPLE
KS := (n, k) -> NumberTheory:-KroneckerSymbol(n, k):
A367546 := n -> local k; add(n^k * abs(KS(n - k , k)), k = 0..n):
seq(A367546(n), n = 0..20);
MATHEMATICA
A367546[n_]:=If[n==0, 0, Sum[n^k*Boole[CoprimeQ[n, k]], {k, 0, n}]]; Array[A367546, 25, 0] (* Paolo Xausa, Nov 24 2023 *)
PROG
(SageMath)
def a(n):
return sum(abs(kronecker_symbol(n - k, k)) * n^k for k in range(n + 1))
# Alternative: (For Python include 'import math' for math.gcd.)
def a(n):
cop = [int(gcd(k, n) == 1) for k in (0..n)]
return sum(p * n^k for k, p in enumerate(cop))
print([a(n) for n in range(21)])
(PARI) a(n) = sum(k=0, n, n^k*abs(kronecker(n-k, k))); \\ Michel Marcus, Nov 23 2023
(Python)
from math import gcd
def A367546(n): return sum(n**k for k in range(n+1) if gcd(n, k)==1) # Chai Wah Wu, Nov 24 2023
CROSSREFS
Sequence in context: A131444 A291541 A180072 * A013315 A032321 A013311
KEYWORD
nonn
AUTHOR
Peter Luschny, Nov 22 2023
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 June 10 10:32 EDT 2024. Contains 373264 sequences. (Running on oeis4.)