[go: up one dir, main page]

login
A333922
a(n) = 1 - (floor(2^n*A002487(n)/A002487(n+1)) mod 2).
2
1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1
OFFSET
0
COMMENTS
The real number Sum_{n >= 0} a(n)/2^n (A346989) is irrational by Cantor's diagonal argument.
FORMULA
a(2^k-1) = 1 for any k >= 0.
a(7*2^n-1) = 0 for any k > 0.
EXAMPLE
The first terms, alongside A002487(n)/A002487(n+1) as a fraction and in binary, are:
n a(n) s(n)/s(n+1) bin(s(n)/s(n+1))
-- ---- ----------- -----------------------------
0 1 0 (0).00000000000000000000...
1 1 1 1.(0)0000000000000000000...
2 1 1/2 0.1(0)000000000000000000...
3 1 2 10.00(0)00000000000000000...
4 0 1/3 0.010(1)0101010101010101...
5 1 3/2 1.1000(0)000000000000000...
6 1 2/3 0.10101(0)10101010101010...
7 1 3 11.000000(0)0000000000000...
8 1 1/4 0.0100000(0)000000000000...
9 1 4/3 1.01010101(0)10101010101...
10 1 3/5 0.100110011(0)0110011001...
11 1 5/2 10.1000000000(0)000000000...
12 1 2/5 0.01100110011(0)01100110...
13 0 5/3 1.101010101010(1)0101010...
14 1 3/4 0.1100000000000(0)000000...
15 1 4 100.00000000000000(0)00000...
PROG
(PARI) A002487(n, a=1, b=0)=for(i=0, #binary(n), if(bittest(n, i), b+=a, a+=b)); b
a(n) = 1 - floor(2^n*A002487(n)/A002487(n+1))%2
(Python)
from functools import reduce
def A333922(n): return (sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(n)[-1:2:-1], (1, 0)))<<n)//sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(n+1)[-1:2:-1], (1, 0)))&1^1 if n else 1 # Chai Wah Wu, May 07 2023
CROSSREFS
Sequence in context: A187944 A105597 A188470 * A071026 A259022 A153490
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 10 2020
STATUS
approved