|
|
A343785
|
|
a(n) is completely multiplicative with a(p^e) = (-1)^e if p == 2 (mod 3) and a(p^e) = 1 otherwise.
|
|
5
|
|
|
1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1
|
|
LINKS
|
Chandler Davis and Donald E. Knuth, Number Representations and Dragon Curves -- I and II, Journal of Recreational Mathematics, volume 3, number 2, April 1970, pages 66-81, and number 3, July 1970, pages 133-149. Reprinted in Donald E. Knuth, Selected Papers on Fun and Games, 2011, pages 571-614. a(n) = d(n) at equation 5.2 and multiplicative at equation 6.3.
|
|
FORMULA
|
a(3*n) = a(n), a(3*n+1) = 1 and a(3*n+2) = -1.
G.f.: Sum_{k>=0} x^(3^k) / (1 + x^(3^k) + x^(2*3^k)).
a(n) = 1 if n is in A182828, otherwise a(n) = -1.
|
|
MATHEMATICA
|
f[p_, e_] := If[Mod[p, 3] == 2, (-1)^e, 1]; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100]
|
|
PROG
|
(PARI) a(n) = my(r); until(r, [n, r]=divrem(n, 3)); -(-1)^r; \\ Kevin Ryde, Nov 09 2021
(Python)
from functools import reduce
from operator import ixor
from sympy import factorint
def A343785(n): return -1 if reduce(ixor, (e&1 if p%3==2 else 0 for p, e in factorint(n).items()), 0) else 1 # Chai Wah Wu, Dec 23 2022
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,mult,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|