cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A196698 Number of primes of the form 3^n +- 3^k +- 1 with 0 <= k < n.

This page as a plain text file.
%I A196698 #49 Apr 03 2023 10:36:12
%S A196698 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,
%T A196698 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,
%U A196698 10,13,20,8,11,10,9,8,16,12,12,13,8,12,14,8,8,10,13,9
%N A196698 Number of primes of the form 3^n +- 3^k +- 1 with 0 <= k < n.
%C A196698 Conjecture: all elements of this sequence are greater than 0.
%C A196698 Conjecture verified up to n = 7399.
%C A196698 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
%C A196698 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
%H A196698 Lei Zhou, <a href="/A196698/b196698.txt">Table of n, a(n) for n = 1..6205</a>
%H A196698 Lei Zhou, <a href="https://t5k.org/primes/page.php?id=119043">A 400,000 decimal digits balanced ternary prime with three non-zero digits,</a> found on Jan 02 2015.
%e A196698 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;
%e A196698 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;
%e A196698 ...
%e A196698 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.
%t A196698 Table[c1 = 3^i; cs = {};
%t A196698 Do[c2 = 3^j; cp = c1 + c2 + 1; If[PrimeQ[cp], cs = Union[cs, {cp}]];
%t A196698   cp = c1 + c2 - 1; If[PrimeQ[cp], cs = Union[cs, {cp}]];
%t A196698   cp = c1 - c2 + 1; If[PrimeQ[cp], cs = Union[cs, {cp}]];
%t A196698   cp = c1 - c2 - 1;
%t A196698   If[PrimeQ[cp], cs = Union[cs, {cp}]], {j, 1, i - 1}];
%t A196698 Length[cs], {i, 2, 100}]
%t A196698 (* Alternative: *)
%t A196698 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 *)
%o A196698 (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
%Y A196698 Cf. A196697.
%K A196698 nonn
%O A196698 1,1
%A A196698 _Lei Zhou_, Oct 05 2011