login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A065085 Smallest prime having alternating bit sum (A065359) equal to -n, or 0 if no such prime exists. 3
3, 2, 43, 0, 683, 2731, 0, 43691, 174763, 0, 2796203, 44608171, 0, 715827881, 715827883, 0, 114532461227, 183251938027, 0, 2931494136491, 2932031007403, 0, 187647836990123, 748400914639531, 0, 11446649052900011, 45786596211600043, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
EXAMPLE
The smallest number having alternating bit sum -n is (2/3)(4^n-1), which for n=4 is 170 = (10101010)2. The least odd number with alternating bit sum -4 is (10)2 || ( (10101010)2 + (1)2 ) = 683, which is prime, so a(4) = 683. - Washington Bomfim, Jan 27 2011
MATHEMATICA
f[n_] := Plus @@ (-(-1)^Range[Floor[Log2@n + 1]] Reverse@ IntegerDigits[n, 2]); a = Table[ f[ Prime[n]], {n, 1, 10^6} ]; b = Table[0, {12} ]; Do[ If[ a[[n]] < 1 && b[[ -a[[n]] + 1]] == 0, b[[ -a[[n]] + 1]] = Prime[n]], {n, 1, 10^6} ]; b
PROG
(PARI)II()={i = (2/3)*(4^n-1) + 1 + 2^(2*n+1); if(isprime(i), return(1)); return(0)};
III()={w = 2^(2*n+3); for(j=1, n+1, i += w; w /= 4; i -= w; if(isprime(i), return(1))); return(0)};
IV()={i+=6; if(isprime(i), return(1)); w=4; for(j=1, n, i -= w; w*=4; i+=w; if(isprime(i), return(1))); return(0)};
V()={i += 2^(2*n+4) - 2^(2*n+2); if(isprime(i), return(1)); w = i + 2^(2*n+5) - 2^(2*n+4); i = w - 2^(2*n+3) - 2^(2*n+1); if(isprime(i), return(1)); w = 2^(2*n+1); for(j=1, n, i += w; w /= 4; i -= w; if(isprime(i), return(1) )); return(0)};
print("0 3"); print("1 2"); for(n=2, 117, if(II(), print(n, " ", i), if(III(), print(n, " ", i), if(IV(), print(n, " ", i), if(V(), print(n, " ", i), if(n%3==0, print(n, " 0"), print(n, " not found."))))))) \\ Washington Bomfim, Feb 06 2011
CROSSREFS
Sequence in context: A096057 A179984 A260888 * A321169 A093398 A002680
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Nov 09 2001
EXTENSIONS
a(13)-a(27) from Washington Bomfim, Jan 27 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 04:13 EDT 2024. Contains 371235 sequences. (Running on oeis4.)