login
A371402
a(n) = gcd(2*n, 4^n)^(2*n + 1) mod (2^(2*n + 1) - 1)^2.
1
0, 8, 63, 128, 1534, 2048, 16383, 32768, 524285, 524288, 4194303, 8388608, 100663294, 134217728, 1073741823, 2147483648, 42949672956, 34359738368, 274877906943, 549755813888, 6597069766654, 8796093022208, 70368744177663, 140737488355328, 2251799813685245
OFFSET
0,2
FORMULA
a(2*n) = 2*4^(2*n)*A001511(2*n) - A001511(n) for n >= 1.
a(2*n+1) = 4^(2*n + 1)*(A001511(2*n + 1) + 1) for n >= 1.
MAPLE
a := n -> modp(igcd(2*n, 4^n)^(2*n + 1), (2^(2*n + 1) - 1)^2):
seq(a(n), n = 0..19);
PROG
(SageMath)
def v2(n): return valuation(2*n, 2)
def a(n):
if n == 0: return 0
return 4^n*(v2(n) + 1) if n % 2 else 2*4^n*v2(n) - v2(n//2)
print([a(n) for n in range(0, 25)])
(PARI) a(n) = lift(Mod(gcd(2*n, 4^n), (2^(2*n + 1) - 1)^2)^(2*n + 1)); \\ Michel Marcus, Mar 27 2024
(Python)
def A371402(n): return ((~n & n-1).bit_length()+2<<(n<<1) if n&1 else ((m:=(~n & n-1).bit_length())+1<<(n<<1)+1)-m) if n else 0 # Chai Wah Wu, Mar 27 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Mar 26 2024
STATUS
approved