# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a362257 Showing 1-1 of 1 %I A362257 #18 Apr 14 2023 02:09:28 %S A362257 1,0,1,2,1,2,3,2,3,2,1,4,3,2,5,2,3,4,3,4,3,2,1,8,3,2,5,4,3,2,9,2,1,6, %T A362257 7,2,3,6,3,4,5,4,5,4,3,2,1,16,-1,0,9,4,-1,6,5,0,7,2,5,4,3,2,17,2,-3, %U A362257 10,3,-2,9,10,3,4,7,4,5,2,7,2,3,6,7,4,3,8 %N A362257 a(n) = 2*Q(n) - n, where Q(n) is Hofstadter's Q-sequence A005185. %C A362257 Just as for A005185, it is not known if this sequence exists for all n. %C A362257 A005185 and this sequence exist as long |a(n)| remains less than n. %F A362257 a(1) = 1, a(2) = 0; a(n) = (1/2)*(3 - a(n-1) - a(n-2)) + a((1/2)*(n + 1 - a(n-1))) + a((1/2)*(n + 2 - a(n-2))) for n >= 3. %o A362257 (Python) %o A362257 from functools import lru_cache %o A362257 @lru_cache(maxsize=None) %o A362257 def A362257(n): return 2-n if n <= 2 else ((a:=1-A362257(n-1))+(b:=2-A362257(n-2))>>1)+A362257(n+a>>1)+A362257(n+b>>1) # _Chai Wah Wu_, Apr 13 2023 %Y A362257 Cf. A005185, A239913. %K A362257 sign %O A362257 1,4 %A A362257 _Nathan Fox_ and Alexis Ducote, Apr 13 2023 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE