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.
%I A338241 #11 Oct 18 2020 22:32:35 %S A338241 0,1,-1,3,-2,2,-3,4,-4,9,-8,8,-6,7,-7,6,-5,5,-9,10,-10,12,-11,11,-12, %T A338241 13,-13,27,-26,26,-24,25,-25,24,-23,23,-18,19,-19,21,-20,20,-21,22, %U A338241 -22,18,-17,17,-15,16,-16,15,-14,14,-27,28,-28,30,-29,29,-30,31 %N A338241 For any m >= 0, a(3*m) = 3*a(m), a(3*m+1) = 1-3*a(m), a(3*m+2) = 3*a(m)-1. %C A338241 This sequence is a variant of A117966. %C A338241 This sequence is a bijection from N = [0..+oo) to Z = (-oo..+oo). %H A338241 Rémy Sigrist, <a href="/A338241/b338241.txt">Table of n, a(n) for n = 0..6560</a> %H A338241 Rémy Sigrist, <a href="/A338241/a338241.png">Scatterplot of the first 3^9 terms</a> %F A338241 Sum_{k = 0..n} a(k) >= 0 with equality iff n belongs to A005823. %e A338241 For n = 0: %e A338241 - a(3*0) = 3*a(0), %e A338241 - so a(0) = 0. %e A338241 For n = 1: %e A338241 - a(1) = 1 - 3*a(0) = 1. %e A338241 For n = 2: %e A338241 - a(2) = 3*a(0) - 1 = -1. %e A338241 For n = 4: %e A338241 - a(4) = 1 - 3*a(1) = -2. %o A338241 (PARI) a(n) = { if (n==0, return (0), my (d=n%3, m=n\3); if (d==0, 3*a(m), d==1, 1-3*a(m), 3*a(m)-1)) } %Y A338241 Cf. A005823, A117966, A338242-A338243 (bisections). %K A338241 sign %O A338241 0,4 %A A338241 _Rémy Sigrist_, Oct 18 2020