Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = k * 2^n + 1
- (1 * 2^1) + 1
- (1 * 2^2) + 1
- (3 * 2^1) + 1
- 3, 5, 9, 13, 17, 25, 33, 41, 49, 57, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209, 225, 241, 257, 289, 321, 353, 385, 417, 449, 481, 513, 545, 577, 609, 641, 673, 705, 737, 769, 801, 833, 865, 897, 929, 961, 993
- ’&C²>
- ’&C²> Main link. Argument: N
- ’ Decrement; yield N - 1.
- C Complement; yield 1 - N.
- & Take the bitwise AND of both results.
- ² Square the bitwise AND.
- > Compare the square to N.
- 1<#<4^IntegerExponent[#-1,2]&
- Reap[Do[If[f[i],Sow[i]],{i,1,1000}]][[2,1]]
- {3, 5, 9, 13, 17, 25, 33, 41, 49, 57, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209, 225, 241, 257, 289, 321, 353, 385, 417, 449, 481, 513, 545, 577, 609, 641, 673, 705, 737, 769, 801, 833, 865, 897, 929, 961, 993}
- BitAnd[#-1,1-#]^2>#&
- <©Ó¬oD®s/›
- [2, 2, 2, 2, 3, 5]
- [2, 2, 2, 2]
- [3, 5]
- qtYF1)EW<
- q % Input x implicitly. Subtract 1
- t % Duplicate
- YF % Exponents of prime factorization of x-1
- 1) % First entry: exponent of 2. Errors for x equal to 1 or 2
- E % Duplicate
- W % 2 raised to that. This is y squared
- < % Is x-1 less than y squared? Implicitly display
- f x=length [x|k<-[1,3..x],n<-[1..x],k*2^n+1==x,2^n>k]>0
- f x=or[k*2^n+1==x|k<-[1,3..x],n<-[1..x],2^n>k]
- ({}[()])(((<>()))){{}([(((({}<(({}){})>){}){})<>[({})(())])](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}}(<{}{}>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>({}<>)
- ({}[()]) #Subtract one from input
- (((<>()))) #Put three ones on the other stack
- {
- {} #Pop the crap off the top
- ([(
- ((({}<(({}){})>){}){}) #Multiply the top by four and the bottom by two
- <>[({})(())])](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{} #Check if the power of four is greater than N-1
- }
- (<{}{}>) #Remove the power of 4
- <>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>({}<{}><>) #Modulo N-1 by the power of two
- ({}[()])(((<>()))){{}([(((({}<(({}){})>){}){})<>[({})(())])](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}}(<{}{}>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>({}<{}><>)
- >N>0,2:N^P:K*+?,P>K:2%1,N:K=
- >N>0,2:N^P:K*+?,P>K:2%1,N:K=
- >N>0 input > N > 0
- 2:N^P 2^N = P
- P:K*+? P*K+1 = input
- P>K P > K
- K:2%1 K%2 = 1
- N:K= [N:K] has a solution
- !x=~-x&-~-x>x^.5
- x=scan()-1;n=0;while(!x%%2){x=x/2;n=n+1};2^(2*n)>x
- %:<<:AND-.
- f =: %:<<:AND-.
- f 16
- 0
- f 17
- 1
- (#~f"0) >: i. 100 NB. Filter the numbers [1, 100]
- 3 5 9 13 17 25 33 41 49 57 65 81 97
- %:<<:AND-. Input: n
- -. Complement. Compute 1-n
- <: Decrement. Compute n-1
- AND Bitwise-and between 1-n and n-1
- %: Square root of n
- < Compare sqrt(n) < ((1-n) & (n-1))
- boolean g(int p){return p--<(p&-p)*(p&-p);}
- boolean f(int p){return(p-1&(1-p))>Math.sqrt(p);}
- boolean g(int p){return Math.pow(p-1&(1-p),2)>p;}
- double g(int p){return Math.pow(p-1&(1-p),2)-p;}
- ((p - 1 & (1 - p))^2) > p;
- qi_(_W*&2#<
- IsProth:=proc(X)local n:=0;local x:=X-1;while x mod 2<>1 do x:=x/2;n:=n+1;end do;is(2^n>x);end proc:
- IsProth := proc( X )
- local n := 0;
- local x := X - 1;
- while x mod 2 <> 1 do
- x := x / 2;
- n := n + 1;
- end do;
- is( 2^n > x );
- end proc:
- x=>x--<(-x&x)**2
- d+
- $*
- +`(1+)1
- $+0
- 01
- 1
- +`.10(0*1)$
- 1$1
- ^10*1$
- d+
- $*
- +`(1+)1
- $+0
- 01
- 1
- +`.10(0*1)$
- 1$1
- ^10*1$
Add Comment
Please, Sign In to add comment