login
A347325
Solution to the spectator-first Tantalizer problem.
1
1, 2, 2, 2, 2, 4, 4, 6, 6, 8, 8, 6, 6, 8, 8, 6, 6, 8, 8, 6, 6, 8, 8, 14, 14, 16, 16, 14, 14, 16, 16, 22, 22, 24, 24, 22, 22, 24, 24, 30, 30, 32, 32, 30, 30, 32, 32, 22, 22, 24, 24, 22, 22, 24, 24, 30, 30, 32, 32, 30, 30, 32, 32, 22, 22, 24, 24, 22, 22, 24, 24
OFFSET
1,2
LINKS
Wei-Tung Chuang, Hong-Bin Chen and Fu-Yuen Hsiao, General solution to the spectator-first Tantalizer problem, Disc. Math. (2021) Vol. 344, No. 10, 112515. Gives first 100 terms.
FORMULA
a(n) = 2 * (floor(n/2) + 1 - a(floor(n/2))) for n > 1. See Zhang's solution. - Zirui Wang, Jan 02 2022
PROG
(Python)
def A347325(n):
a = [i for i in range(1, n+1)]
while len(a) != 1:
del a[:len(a)+1:2]
a.reverse()
return a[-1] # Marc Kouyoumdjian, Dec 15 2021
(Python)
def a(n):
return 1 if n <= 1 else 2 * (n // 2 + 1 - a(n // 2))
# See Zhang's solution. - Zirui Wang, Jan 02 2022
(Python)
from math import log, log2
def A347325(n):
return (-2) ** int(log2(n)) // 3 + 1 + (n & int('a' * int(log(n, 16) + 1), 16))
# Zirui Wang, Jan 03 2022
(PARI) a(n)={my(s=1, v=0); while(n>1, n=n\2; s=-2*s; v-=s*(1+n)); v+s} \\ Andrew Howroyd, Jan 02 2022
CROSSREFS
Sequence in context: A349388 A347663 A071809 * A324762 A104976 A325710
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 13 2021
STATUS
approved