Cheers, 15 PRENUMBERED NEW SEQUENCES: A080110-A080120, A080146-A080148, A080261 follow: %I A080110 %S A080110 0,1,1,1,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0, %T A080110 0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0, %U A080110 1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1 %N A080110 Characteristic function of A080112. %R A080110 %O A080110 1,1 %K A080110 nonn %A A080110 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %D A080110 %p A080110 A080110 := n -> A080116(A080117(n)); %I A080111 %S A080111 1,0,0,0,0,0,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1, %T A080111 1,1,0,1,1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1, %U A080111 0,1,0,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,0 %N A080111 Characteristic function of A080113. %R A080111 %O A080111 1,1 %K A080111 nonn %A A080111 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %D A080111 %p A080111 A080111 := n -> 1-A080116(A080117(n)); %I A080112 %S A080112 2,3,4,5,6,9,11,12,15,17,20,22,23,27,32,36,39,43,46,52,54,56,58,64,72,76,81,83,85,92,96,103, %T A080112 109,111,118,120,128,132,133,146,150,154,156,157,164,166,167,173,175,179,182,185,190,200,202, %U A080112 207,215,222,225,228,229,233,236,240,246,250,274,280,281,283,286,289,294,297,299,303,309,311 %N A080112 Positions of A080114 in A000040. %R A080112 %O A080112 1,1 %K A080112 nonn %A A080112 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080112 Complement of A080113. Characteristic function: A080110. %D A080112 %p A080112 A080112 := proc(n) option remember; local i; if(1 = n) then RETURN(2); fi; i := A080112(n-1)+1; while(i > 0) do if(A080110(i) > 0) then RETURN(i); fi; i := i+1; od; end; %I A080113 %S A080113 1,7,8,10,13,14,16,18,19,21,24,25,26,28,29,30,31,33,34,35,37,38,40,41,42,44,45,47,48,49,50, %T A080113 51,53,55,57,59,60,61,62,63,65,66,67,68,69,70,71,73,74,75,77,78,79,80,82,84,86,87,88,89,90, %U A080113 91,93,94,95,97,98,99,100,101,102,104,105,106,107,108,110,112,113,114,115,116,117,119,121,122 %N A080113 Positions of A080115 in A000040. %R A080113 %O A080113 1,2 %K A080113 nonn %A A080113 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080113 Complement of A080112. Characteristic function: A080111. %D A080113 %p A080113 A080113 := proc(n) option remember; local i; if(1 = n) then RETURN(1); fi; i := A080113(n-1)+1; while(i > 0) do if(A080111(i) > 0) then RETURN(i); fi; i := i+1; od; end; %I A080114 %S A080114 3,5,7,11,13,23,31,37,47,59,71,79,83,103,131,151,167,191,199,239,251,263,271,311,359,383,419, %T A080114 431,439,479,503,563,599,607,647,659,719,743,751,839,863,887,911,919,971,983,991,1031,1039, %U A080114 1063,1091,1103,1151,1223,1231,1279,1319,1399,1427,1439,1447,1471,1487,1511,1559,1583,1759 %N A080114 Odd primes for which all sums Sum_{j=1..u} L(j/p) (with u ranging from 1 to (p-1)/2) are non-negative, where L(j/p) is Legendre symbol of j and p, which is defined to be 1 if j is a quadratic residue (mod p) and -1 if j is a quadratic non-residue (mod p). %C A080114 This sequence contains those 4k+1 primes p for which the first half (the (p-1)/2 most significant bits) of A055094(p) is in A014486, and those 4k+3 primes q, for which the whole A055094(q) is in A014486. %C A080114 Are the 2nd, 5th and 8th primes (5,13,37) only terms of this sequence that are of the form 4k+1 ? [Searched upto a(211)=7927 by AK.] %R A080114 %H A080114 A. Karttunen, Illustration of Legendre's candelabras %O A080114 1,1 %K A080114 nonn %A A080114 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080114 Cf. A080112, A080115. These are the primes for which a "Legendre's candelabra" can be constructed, see A080120. %D A080114 %p A080114 with(numtheory); # For ithprime and legendre. %p A080114 A080114 := n -> ithprime(A080112(n)); %p A080114 A080114v2 := proc(upto_n) local j,a,p,i,s; a := []; for i from 2 to upto_n do p := ithprime(i); s := 0; for j from 1 to (p-1)/2 do s := s + legendre(j,p); if(s < 0) then break; fi; od; if(s >= 0) then a := [op(a),p]; fi; od; RETURN(a); end; %I A080115 %S A080115 2,17,19,29,41,43,53,61,67,73,89,97,101,107,109,113,127,137,139,149,157,163,173,179,181,193, %T A080115 197,211,223,227,229,233,241,257,269,277,281,283,293,307,313,317,331,337,347,349,353,367,373, %U A080115 379,389,397,401,409,421,433,443,449,457,461,463,467,487,491,499,509,521,523,541,547,557,569 %N A080115 Primes not in A080114. %R A080115 %O A080115 1,1 %K A080115 nonn %A A080115 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080115 Cf. A080113. %D A080115 %p A080115 A080115 := n -> ithprime(A080113(n)); %I A080116 %S A080116 1,0,1,0,0,0,0,0,0,0,1,0,1,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, %T A080116 0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, %U A080116 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,0,0,0,0,0,0,0 %N A080116 Characteristic function of A014486. a(n) = 1 if n's binary expansion is totally balanced, otherwise zero. %R A080116 %O A080116 0,1 %K A080116 nonn %A A080116 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080116 Cf. A080110-A080111. %D A080116 %p A080116 A080116 := proc(n) local c,lev; lev := 0; c := n; while(c > 0) do lev := lev + (-1)^c; c := floor(c/2); if(lev < 0) then RETURN(0); fi; od; if(lev > 0) then RETURN(0); else RETURN(1); fi; end; %I A080117 %S A080117 2,10,52,738,2866,53620,162438,4023888,166243974,921787428,48034443442,935251508324,2558696229078, %T A080117 68055676507664,2655011787909270,210067141980993186,831463106366605026,42882922858578320598, %U A080117 1170565600000913519680,4529928692459500041808,257265188079961379006564,3380147659553723806281906 %N A080117 Binary encoding of quadratic residue set formed for nth prime, coerced to "complementarily symmetric binary sequence" with A080261 if the prime is of the form 4k+1. %R A080117 %O A080117 2,1 %K A080117 nonn %A A080117 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080117 a(A080148(n)) = A080146(A080148(n)). Cf. A080118. %D A080117 %p A080117 with(numtheory,ithprime); A080117 := proc(n) local c,p; p := ithprime(n); c := A055094(p); if(3 = (p mod 4)) then RETURN(c); else RETURN(A080261(c)); fi; end; %I A080118 %S A080118 2,10,52,738,2866,4023888,921787428,48034443442,68055676507664,210067141980993186,1170565600000913519680, %T A080118 257265188079961379006564,3380147659553723806281906,4190418227928183517574537416244,992831470107559937078571617098972734114, %U A080118 1214736977207676206222358921130212066852894820,90506669717987347037870604385330707530711669756432 %N A080118 Intersect of A080117 and A014486. %R A080118 %O A080118 1,1 %K A080118 nonn %A A080118 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080118 a(n) = A014486(A080119(n)). Same sequence in binary: A080120. %D A080118 %p A080118 A080118 := n -> A080117(A080112(n)); %I A080119 %S A080119 1,2,7,33,81,74395,8369196,215802898,414859094165,520973680640109,4064761999842441067,517978450857911919447, %T A080119 4255027826896017770661,5222501054779098990032001033,718000720375918750838217734094612383 %N A080119 Positions of A080118 in A014486. %R A080119 %O A080119 1,2 %K A080119 nonn %A A080119 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %D A080119 %p A080119 A080119 := n -> CatalanRankGlobal(A080118(n)); %I A080120 %S A080120 10,1010,110100,1011100010,101100110010,1111010110011001010000,110110111100010101110000100100,101100101111000100110111000010110010, %T A080120 1111011110010101110010011011000101011000010000,1011101010010011101111001111100000110000100011011010100010, %U A080120 1111110111010011011100011010110100011101001010011100010011010001000000 %N A080120 Dyck path encodings of Legendre's candelabras formed for primes in A080114. (I.e. symmetric rooted plane trees constructed from their quadratic residue sets). %F A080120 a(n) = A063171(A080119(n)) %C A080120 For the 2nd, 5th and 8th term of the sequence, the quadratic residue set of the corresponding prime (5,13,37, of the form 4k+1) has been converted from symmetric to complementarily symmetric as 1001->1010, 101100001101->101100110010, 101100101111000100001000111101001101->101100101111000100110111000010110010, for the others (of the form 4k+3), it is the quadratic residue set encoded as in A055094 (with +1 mapped to 1, and -1 to 0). %H A080120 A. Karttunen, Illustration of initial terms %R A080120 %O A080120 1,1 %K A080120 nonn %A A080120 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080120 Same sequence in decimal: A080118. Cf. A080114. %D A080120 %p A080120 A080120 := n -> convert(A080118(n),binary); %I A080146 %S A080146 1,2,9,52,738,2829,53643,162438,4023888,166236537,921787428,48034254669,935251837851,2558696229078, %T A080146 68055676507664,2655011771373417,210067141980993186,831463105466530077,42882922858578320598, %U A080146 1170565600000913519680,4529928692498348542383,257265188079961379006564,3380147659553723806281906 %N A080146 Binary encoding of quadratic residue set for each prime. a(n) = A055094(A000040(n)) %R A080146 %O A080146 1,2 %K A080146 nonn %A A080146 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080146 a(A080148(n)) = A080117(A080148(n)). %D A080146 %p A080146 with(numtheory,ithprime); A080146 := n -> A055094(ithprime(n)); %I A080147 %S A080147 3,6,7,10,12,13,16,18,21,24,25,26,29,30,33,35,37,40,42,44,45,50,51,53,55,57,59,60,62,65,66, %T A080147 68,70,71,74,77,78,79,80,82,84,87,88,89,97,98,100,102,104,106,108,110,112,113,116,119,121,122, %U A080147 123,126,127,130,134,135,136,137,139,140,142,145,147,148,151,152,158,159,160,162,165,168,169 %N A080147 Positions of 4k+1 primes A002144 among all primes A000040. %R A080147 %O A080147 1,1 %K A080147 nonn %A A080147 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080147 Almost complement of A080148. (One is excluded from both). A002144 = A000040(a(n)). %D A080147 %p A080147 with(numtheory,ithprime); pos_of_primes_k_mod_n(300,1,4); %p A080147 pos_of_primes_k_mod_n := proc(upto_i,k,n) local i,a; a := []; for i from 1 to upto_i do if(k = (ithprime(i) mod n)) then a := [op(a),i]; fi; od; RETURN(a); end; %I A080148 %S A080148 2,4,5,8,9,11,14,15,17,19,20,22,23,27,28,31,32,34,36,38,39,41,43,46,47,48,49,52,54,56,58,61, %T A080148 63,64,67,69,72,73,75,76,81,83,85,86,90,91,92,93,94,95,96,99,101,103,105,107,109,111,114,115, %U A080148 117,118,120,124,125,128,129,131,132,133,138,141,143,144,146,149,150,153,154,155,156,157,161 %N A080148 Positions of 4k+3 primes A002145 among all primes A000040. %R A080148 %O A080148 1,1 %K A080148 nonn %A A080148 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080148 Almost complement of A080147. (One is excluded from both). %D A080148 %p A080148 pos_of_primes_k_mod_n(300,3,4); # Given in A080147. %I A080261 %S A080261 0,1,3,2,5,4,7,6,11,10,9,8,15,14,13,12,19,18,17,16,23,22,21,20,27,26,25,24,31,30,29,28,39,38, %T A080261 37,36,35,34,33,32,47,46,45,44,43,42,41,40,55,54,53,52,51,50,49,48,63,62,61,60,59,58,57,56, %U A080261 71,70,69,68,67,66,65,64,79,78,77,76,75,74,73,72,87,86,85,84,83,82,81,80,95,94,93,92,91,90 %N A080261 Simple involution of natural numbers: complement [binary_width(n)/2] least significant bits in the binary expansion of n. %e A080261 Binary expansion of 9 is 1001, we complement 4/2 = two rightmost bits, yielding 1010 = 10, thus a(9)=10. Binary expansion of 20 is 10100, we complement [5/2] = 2 rightmost bits, giving 10111 = 23, thus a(20)=23. %R A080261 %H A080261 Index entries for sequences that are permutations of the natural numbers %H A080261 N. J. A. Sloane, Maple implementation of bitwise AND (ANDnos) %O A080261 0,3 %K A080261 nonn %A A080261 Antti Karttunen (my_firstname.my_surname@iki.fi) Feb 11 2003 %Y A080261 Used to construct A080117. %D A080261 %p A080261 A080261 := proc(n) local w; w := floor(binwidth(n)/2); RETURN(((2^w)*floor(n/(2^w)))+(((2^w)-1)-ANDnos(n,(2^w)-1))); end; %p A080261 binwidth := n -> (`if`((0 = n),1,floor_log_2(n)+1)); %p A080261 floor_log_2 := proc(n) local nn,i; nn := n; for i from -1 to n do if(0 = nn) then RETURN(i); fi; nn := floor(nn/2); od; end; ----------------------------------------------------------------------------------- Yours, Antti Karttunen