login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Please make a donation (tax deductible in USA) to keep the OEIS running. Over 5000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A065084 Smallest prime having alternating bit sum (A065359) equal to n. 1
3, 7, 5, 0, 277, 1109, 0, 17749, 70997, 0, 1398037, 5526869, 0, 72701269, 357915989, 0, 5659514197, 22902297941, 0, 297784399189, 1465948394837, 0, 23456248042837, 89426945725781, 0, 1430831131612501, 6004798429418837, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

Only 3d = 11b has an alternating sum of 0 and alternated sums of 3*k are impossible for primes.

LINKS

Table of n, a(n) for n=0..27.

W. Bomfim, Table of n, a(n) for n = 1..121

EXAMPLE

a(4)=277 since the smallest number having alternating bit sum n is (4^n-1)/3, which for n = 4 is 85. Because 85 =(1010101)2 is composite, the next number with alternating bit sum 4 is the prime (100010101)2 = 277. - Washington Bomfim, Jan 21 2011

MATHEMATICA

f[n_] := (d = Reverse[ IntegerDigits[n, 2]]; l = Length[d]; s = 0; k = 1; While[k < l + 1, s = s - (-1)^k*d[[k]]; k++ ]; s); a = Table[ f[ Prime[n]], {n, 1, 10^6} ]; b = Table[0, {13} ];

Do[ If[ a[[n]] > -1 && b[[a[[n]] + 1]] == 0, b[[a[[n]] + 1]] = Prime[n]], {n, 1, 10^6} ]; b

PROG

(PARI)M(n)={return((4^n - 1)/3 + 2^(2*n) - 2^(2*n-2))};

T(n, k)={pow2=2^(2*n-2); k+=pow2; for(j=1, n-2, pow2/=4; k-=pow2; if(isprime(k), return(k), k+=pow2; )); return(k)};

T2(n, k)={pow2=2; for(j=1, n, k+=pow2; if(isprime(k), return(k), k-=pow2; pow2*=4)); return(k)};

print("0 3"); print("1 7"); print("2 5"); print("3 0"); for(n=4, 127, if(n%3==0, print(n, " 0"), k=M(n); if(isprime(k), print(n, " ", k), k=T(n, k); if(isprime(k), print(n, " ", k), k=T2(n, k); if(isprime(k), print(n, " ", k), print("a(", n, ") not found")))))) \\ Washington Bomfim, Jan 22 2011

CROSSREFS

Cf. A065359, A002450.

Sequence in context: A193506 A086242 A096627 * A132742 A267317 A210641

Adjacent sequences:  A065081 A065082 A065083 * A065085 A065086 A065087

KEYWORD

base,nonn

AUTHOR

Robert G. Wilson v, Nov 09 2001

EXTENSIONS

a(14)-a(27) from Washington Bomfim, Jan 21 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 | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified December 9 23:16 EST 2016. Contains 278993 sequences.