OFFSET
1,1
COMMENTS
Also positions of 2's and 3's in A003324.
Also positions of 1's in A292077. - Jianing Song, Nov 27 2021
Numbers of the form (2*k+1) * 2^e where k+e is odd. In other words, union of {(4*m+1) * 2^(2t+1)} and {(4*m+3) * 2^(2t)}, where m >= 0, t >= 0.
Numbers whose quaternary (base-4) expansion ends in 300...00 or 0200..00 or 2200..00. Trailing 0's are not necessary.
There are precisely 2^(N-1) terms <= 2^N for every N >= 1.
Complement of A338692. - Jianing Song, Apr 26 2021
LINKS
Jianing Song, Table of n, a(n) for n = 1..8192
Kevin Ryde, Iterations of the Alternate Paperfolding Curve, see index "TurnRight" with a(n) = TurnRight(n-1).
FORMULA
a(n) = A343501(n)/2. - Jianing Song, Apr 26 2021
EXAMPLE
15 is a term since it is in the family {(4*m+3) * 2^(2t)} with m = 3, t = 0.
18 is a term since it is in the family {(4*m+1) * 2^(2t+1)} with m = 2, t = 0.
MATHEMATICA
A338691Q[k_] := JacobiSymbol[-1, k]*(-1)^IntegerExponent[k, 2] == -1;
Select[Range[200], A338691Q] (* Paolo Xausa, Feb 26 2025 *)
PROG
(PARI) isA338691(n) = my(e=valuation(n, 2), k=bittest(n, e+1)); (k+e)%2
(Python)
def A338691(n):
def f(x): return n+x-sum(((x>>i)-1>>2)+1 for i in range(1, x.bit_length(), 2))-sum(((x>>i)-3>>2)+1 for i in range(0, x.bit_length(), 2))
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m # Chai Wah Wu, Feb 24 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jianing Song, Apr 24 2021
STATUS
approved
