cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A346690 Replace 6^k with (-1)^k in base-6 expansion of n.

This page as a plain text file.
%I A346690 #19 Nov 22 2022 22:19:18
%S A346690 0,1,2,3,4,5,-1,0,1,2,3,4,-2,-1,0,1,2,3,-3,-2,-1,0,1,2,-4,-3,-2,-1,0,
%T A346690 1,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,0,1,2,3,4,5,-1,0,1,2,3,4,-2,-1,0,1,2,
%U A346690 3,-3,-2,-1,0,1,2,-4,-3,-2,-1,0,1,2,3,4,5,6,7,1,2,3,4,5,6,0,1,2,3,4,5,-1,0,1,2,3,4,-2,-1,0,1,2,3,-3,-2,-1
%N A346690 Replace 6^k with (-1)^k in base-6 expansion of n.
%C A346690 If n has base-6 expansion abc..xyz with least significant digit z, a(n) = z - y + x - w + ...
%H A346690 Robert Israel, <a href="/A346690/b346690.txt">Table of n, a(n) for n = 0..10000</a>
%F A346690 G.f. A(x) satisfies: A(x) = x * (1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4) / (1 - x^6) - (1 + x + x^2 + x^3 + x^4 + x^5) * A(x^6).
%F A346690 a(n) = n + 7 * Sum_{k>=1} (-1)^k * floor(n/6^k).
%F A346690 a(6*n+j) = j - a(n) for 0 <= j <= 5. - _Robert Israel_, Nov 21 2022
%e A346690 59 = 135_6, 5 - 3 + 1 = 3, so a(59) = 3.
%p A346690 f:= proc(n) option remember; (n mod 6) - procname(floor(n/6)) end proc:
%p A346690 f(0):= 0:
%p A346690 map(f, [$1..100]); # _Robert Israel_, Nov 21 2022
%t A346690 nmax = 104; A[_] = 0; Do[A[x_] = x (1 + 2 x + 3 x^2 + 4 x^3 + 5 x^4)/(1 - x^6) - (1 + x + x^2 + x^3 + x^4 + x^5) A[x^6] + O[x]^(nmax + 1) // Normal, nmax + 1]; CoefficientList[A[x], x]
%t A346690 Table[n + 7 Sum[(-1)^k Floor[n/6^k], {k, 1, Floor[Log[6, n]]}], {n, 0, 104}]
%o A346690 (Python)
%o A346690 from sympy.ntheory.digits import digits
%o A346690 def a(n):
%o A346690     return sum(bi*(-1)**k for k, bi in enumerate(digits(n, 6)[1:][::-1]))
%o A346690 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Jul 29 2021
%o A346690 (PARI) a(n) = subst(Pol(digits(n, 6)), 'x, -1); \\ _Michel Marcus_, Nov 22 2022
%Y A346690 Cf. A007092, A053827, A055017, A065359, A065368, A346688, A346689, A346691.
%K A346690 sign,base,easy
%O A346690 0,3
%A A346690 _Ilya Gutkovskiy_, Jul 29 2021