A341707 a(n) is the binary representation of n converted to yranib.
0, 1, 2, 1, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, -38, -39, -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50, -51, -52, -53, 46, 45, 44, 43, 42, 41
Offset: 0
Examples
If n = 48 = 110000_2, b_0 = ... = b_3 = 0, b_4 = b_5 = 1, so a(48) = A004094(5) - A004094(4) = 23 - 61 = -38, which is the first negative term (cf. A341708).
References
- Eric Angelini, Posting to Math Fun Mailing List, Feb 18 2021
Links
- Jinyuan Wang, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
Mathematica
{0}~Join~Array[Fold[Subtract, Reverse@ IntegerReverse[2^(-1 + Position[Reverse@ IntegerDigits[#, 2], 1][[All, 1]] )]] &, 69] (* Michael De Vlieger, Feb 25 2021 *)
-
PARI
/* Get decimal value of yranib representation of n written in binary (i.e., write n in binary, e.g., 9[10] = 1001[2], then read this in the yranib system,where the k-th position from the right has value s*R(2^k) where R=reverse(= decimal value read from right to left) and s = -1 except for the largest k. */ y2d(n)=if(n=binary(n),n[1]*=-1);-sum(k=0,#n-1,n[#n-k]*R(2^k)) R(n)=fromdigits(Vecrev(digits(n))) apply(y2d, [0..99]) \\ M. F. Hasler, Feb 18 2021
-
Python
def reverse(n): s = 0 while n > 0: d, n = n%10, n//10 s = 10*s+d return s def A341707(n): s, t = 0, 1 while n > 0: b, n = n%2, n//2 if n > 0: s, t = reverse(t*b)+s, 2*t else: s = reverse(t*b)-s return s # A.H.M. Smeets, Feb 18 2021
Extensions
Further terms from M. F. Hasler, Feb 18 2021
Comments