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.

A346689 Replace 5^k with (-1)^k in base-5 expansion of n.

This page as a plain text file.
%I A346689 #12 Aug 01 2021 14:43:58
%S A346689 0,1,2,3,4,-1,0,1,2,3,-2,-1,0,1,2,-3,-2,-1,0,1,-4,-3,-2,-1,0,1,2,3,4,
%T A346689 5,0,1,2,3,4,-1,0,1,2,3,-2,-1,0,1,2,-3,-2,-1,0,1,2,3,4,5,6,1,2,3,4,5,
%U A346689 0,1,2,3,4,-1,0,1,2,3,-2,-1,0,1,2,3,4,5,6,7,2,3,4,5,6,1,2,3,4,5,0,1,2,3,4,-1,0,1,2,3,4,5,6,7,8
%N A346689 Replace 5^k with (-1)^k in base-5 expansion of n.
%C A346689 If n has base-5 expansion abc..xyz with least significant digit z, a(n) = z - y + x - w + ...
%F A346689 G.f. A(x) satisfies: A(x) = x * (1 + 2*x + 3*x^2 + 4*x^3) / (1 - x^5) - (1 + x + x^2 + x^3 + x^4) * A(x^5).
%F A346689 a(n) = n + 6 * Sum_{k>=1} (-1)^k * floor(n/5^k).
%e A346689 48 = 143_5, 3 - 4 + 1 = 0, so a(48) = 0.
%t A346689 nmax = 104; A[_] = 0; Do[A[x_] = x (1 + 2 x + 3 x^2 + 4 x^3)/(1 - x^5) - (1 + x + x^2 + x^3 + x^4) A[x^5] + O[x]^(nmax + 1) // Normal, nmax + 1]; CoefficientList[A[x], x]
%t A346689 Table[n + 6 Sum[(-1)^k Floor[n/5^k], {k, 1, Floor[Log[5, n]]}], {n, 0, 104}]
%o A346689 (Python)
%o A346689 from sympy.ntheory.digits import digits
%o A346689 def a(n):
%o A346689     return sum(bi*(-1)**k for k, bi in enumerate(digits(n, 5)[1:][::-1]))
%o A346689 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Jul 29 2021
%Y A346689 Cf. A007091, A053824, A055017, A065359, A065368, A346688, A346690, A346691.
%K A346689 sign,base
%O A346689 0,3
%A A346689 _Ilya Gutkovskiy_, Jul 29 2021