OFFSET
0,2
COMMENTS
The decimal equivalents of A367547.
FORMULA
a(n) = Sum_{k=0..n} 2^k * |(n - k | k)|, where (a | b) denotes the Kronecker symbol.
a(n) = Sum_{k=0..n} [gcd(k, n) = 1] * 2^k, where [] is the Iverson bracket.
MAPLE
MATHEMATICA
A367544[n_]:=FromDigits[Boole[CoprimeQ[n, Range[0, n]]], 2];
Array[A367544, 50, 0] (* Paolo Xausa, Nov 24 2023 *)
PROG
(SageMath) # For Python include 'import math' for math.gcd.
def a(n):
cop = [int(gcd(i, n) == 1) for i in range(n + 1)]
return sum(p * 2^k for k, p in enumerate(cop))
print([a(n) for n in range(35)])
(PARI) a(n) = sum(k=0, n, 2^k*abs(kronecker(n-k, k))); \\ Michel Marcus, Nov 23 2023
(PARI) a(n) = fromdigits(vector(n+1, i, gcd(i-1, n)==1), 2); \\ Michel Marcus, Nov 24 2023
(Python)
from math import gcd
def A367544(n): return sum(1<<k for k in range(n+1) if gcd(n, k)==1) # Chai Wah Wu, Nov 24 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Peter Luschny, Nov 22 2023
STATUS
approved