%I #29 Sep 08 2022 08:45:55
%S 0,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,
%T 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%N a(2^(k+1)) = k; 0 everywhere else.
%C A surjection N->N designed to spite a guesser who is trying to guess whether it's a surjection, using the following naive guessing method: Guess that (n0,...,nk) is a subsequence of a surjection iff it contains every natural less than log_2(k+1).
%C This sequence causes the would-be guesser to change his mind infinitely often.
%C a(0)=0. Assume a(0),...,a(n) have been defined.
%C If the above guesser guesses that (a(0),...,a(n)) IS the beginning of a surjective sequence, then let a(n+1)=0. Otherwise let a(n+1) be the least number not in (a(0),...,a(n)).
%H Antti Karttunen, <a href="/A182660/b182660.txt">Table of n, a(n) for n = 0..65537</a>
%H S. Alexander, <a href="http://arxiv.org/abs/1011.6626">On Guessing Whether A Sequence Has A Certain Property</a>, arXiv:1011.6626 [math.LO], 2010-2012.
%H S. Alexander, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Alexander/alex2.html">On Guessing Whether A Sequence Has A Certain Property</a>, J. Int. Seq. 14 (2011) # 11.4.4.
%o (Magma) [ exists(t){ k: k in [1..Ceiling(Log(n+1))] | n eq 2^(k+1) } select t else 0: n in [0..100] ];
%o (PARI) A182660(n) = if(n<2,0,my(p = 0, k = isprimepower(n,&p)); if(2==p,k-1,0)); \\ _Antti Karttunen_, Jul 22 2018
%Y Cf. A082691, A135416, A209229.
%K nonn
%O 0,9
%A _Sam Alexander_, Nov 27 2010