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!)
A196698 Number of primes of the form 3^n +- 3^k +- 1 with 0 <= k < n. 6
2, 4, 6, 8, 7, 11, 7, 10, 11, 11, 8, 10, 9, 11, 14, 11, 10, 14, 7, 16, 12, 12, 7, 17, 10, 7, 15, 13, 4, 11, 11, 11, 13, 6, 12, 18, 9, 12, 17, 14, 13, 11, 10, 11, 13, 6, 7, 17, 9, 14, 9, 10, 13, 20, 8, 11, 10, 9, 8, 16, 12, 12, 13, 8, 12, 14, 8, 8, 10, 13, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Conjecture: all elements of this sequence are greater than 0.
Conjecture verified up to n = 7399.
I conjecture the contrary: infinitely many elements of this sequence are equal to 0. Probably the first n with a(n) = 0 is less than a million. - Charles R Greathouse IV, Nov 21 2011
This is also number of primes in n-digit balanced ternary form with no more than three nonzero digits for n > 1. - Lei Zhou, Dec 04 2013
LINKS
EXAMPLE
n = 1, 3 = 3^1 + 3^0 - 1 = 3^1 - 3^0 + 1; 5 = 3^1 + 3^0 + 1, two primes found, so a(1) = 2;
n = 2, 5 = 3^2 - 3^1 - 1; 7 = 3^2 - 3^1 + 1 = 3^2 - 3^0 - 1; 11 = 3^2 + 3^1 - 1 = 3^2 + 3^0 + 1; 13 = 3^2 + 3^1 + 1, four primes found, so a(2) = 4;
...
n = 7, 1459 = 3^7 - 3^6 + 1; 2161 = 3^7 - 3^3 + 1; 2179 = 3^7 - 3^1 + 1; 2213 = 3^7 + 3^3 - 1; 2267 = 3^7 + 3^4 - 1; 2269 = 3^7 + 3^4 + 1; 2917 = 3^7 + 3^6 + 1, seven primes found, so a(7) = 7.
MATHEMATICA
Table[c1 = 3^i; cs = {};
Do[c2 = 3^j; cp = c1 + c2 + 1; If[PrimeQ[cp], cs = Union[cs, {cp}]];
cp = c1 + c2 - 1; If[PrimeQ[cp], cs = Union[cs, {cp}]];
cp = c1 - c2 + 1; If[PrimeQ[cp], cs = Union[cs, {cp}]];
cp = c1 - c2 - 1;
If[PrimeQ[cp], cs = Union[cs, {cp}]], {j, 1, i - 1}];
Length[cs], {i, 2, 100}]
(* Alternative: *)
Table[s = 3^i; ct = 0; Do[t = 3^j; a1 = s + t; a2 = s - t; If[PrimeQ[a1 + 1], ct++]; If[PrimeQ[a1 - 1], ct++]; If[PrimeQ[a2 + 1], ct++]; If[PrimeQ[a2 - 1], ct++], {j, 1, i - 1}]; ct, {i, 2, 100}] (* Lei Zhou, Mar 19 2015 *)
PROG
(PARI) a(n)=sum(k=0, n-1, isprime(3^n-3^k-1)+isprime(3^n-3^k+1)+isprime(3^n+3^k-1)+isprime(3^n+3^k+1)) \\ Charles R Greathouse IV, Oct 06 2011
CROSSREFS
Cf. A196697.
Sequence in context: A319805 A055950 A294428 * A295079 A237047 A021806
KEYWORD
nonn
AUTHOR
Lei Zhou, Oct 05 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 19 02:49 EDT 2024. Contains 370952 sequences. (Running on oeis4.)