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.

Showing 1-6 of 6 results.

A196788 a(n) is the first occurrence of n in A196697.

Original entry on oeis.org

1, 1805, 133, 2, 3, 4, 5, 13, 6, 9, 8, 10, 19, 16, 32, 24, 74, 30, 18, 60, 168, 20, 42, 90, 180, 210, 186, 408, 144, 1020, 1050, 900, 2520, 3348, 2850, 5520, 3390, 774, 5760
Offset: 1

Views

Author

Lei Zhou, Oct 06 2011

Keywords

Comments

a(39+k) > 9594, for any k >= 1. It is getting much harder for n>39. It took the Mathematica program weeks to get the first 39 items.

Examples

			A196697(1)=1, a(1)=1;
A196697(2)=4, a(4)=2;
...
A196697(1805)=2, a(2)=1805; (for any k<1805, A196697(k)<>2)
		

Crossrefs

Cf. A196697.

Programs

  • Mathematica
    b = 2; max = 39; Array[fa, max]; Do[
    fa[k] = 0, {k, 1, max}]; filled = 0; i = 0; While[filled < max, i++;
    c1 = b^i; cs = {};
    Do[c2 = b^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, 0, i - 1}];
    ct = Length[cs];
    If[ct <= max, If[fa[ct] == 0, fa[ct] = i; filled++]]]; Table[
    fa[k], {k, 1, max}]

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

Original entry on oeis.org

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
Offset: 1

Views

Author

Lei Zhou, Oct 05 2011

Keywords

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

Examples

			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.
		

Crossrefs

Cf. A196697.

Programs

  • 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 *)
  • 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

A238900 Least k such that one of 2^n +- 2^k +- 1 is prime, where 0 < k < n, or 0 if there is no such prime.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 12, 2, 11, 1, 1, 1, 1, 2, 3, 9, 5, 2, 3, 3, 3, 4, 5, 4, 8, 3, 7, 4, 2, 6, 17, 14, 6, 12, 2, 5, 1, 2, 3, 6, 11, 5, 1, 16, 8, 8, 20, 2, 1, 5, 7, 19, 6, 4, 19, 8, 5, 4, 5, 3, 9, 6, 4, 3, 13, 1, 24
Offset: 2

Views

Author

T. D. Noe, Mar 17 2014

Keywords

Comments

Does a(n) = 0 for some n?

Crossrefs

Cf. A196697.

Programs

  • Mathematica
    Table[c1 = 2^n; k = 1; While[c2 = 2^k; k < n && ! (PrimeQ[c1 + c2 + 1] || PrimeQ[c1 + c2 - 1] || PrimeQ[c1 - c2 + 1] || PrimeQ[c1 - c2 - 1]), k++]; If[k == n, 0, k], {n, 2, 100}]

A196778 a(n) is the number of primes in the form of 4^n+/-4^k+/-1, while 0 <= k < n.

Original entry on oeis.org

1, 3, 5, 6, 7, 7, 9, 8, 9, 12, 7, 9, 4, 4, 8, 11, 6, 11, 7, 8, 14, 7, 8, 11, 6, 10, 9, 8, 8, 11, 6, 10, 13, 7, 6, 9, 10, 8, 8, 10, 5, 10, 15, 6, 11, 9, 14, 7, 8, 16, 12, 10, 5, 10, 9, 8, 10, 8, 7, 10, 11, 13, 12, 6, 12, 9, 4, 10, 12, 13, 8, 14, 7, 2, 13, 7
Offset: 1

Views

Author

Lei Zhou, Oct 06 2011

Keywords

Comments

Conjecture: all elements of this sequence is greater than 0.
Conjecture tested hold up to n=2355. Further test is still running
The Mathematica program gives the first 100 terms.
Terms for all n are tend to be small integers.
4^n+/-4^k+/-1=2^2n+/-2^2k+/-1

Examples

			n=1, 2=4^1-4^0-4^0, 1 prime found, so a(1)=1;
n=2, 11=4^2-4^1-1; 13=4^2-4^1+1; 19=4^2+4^1-1, 3 primes found, so a(2)=3;
...
n=13, 67043329=4^13-4^8+1; 67104769=4^13-4^6+1; 67108859=4^13-4^1-1; 67108879=4^13+4^2-1, 4 primes found, so a(13)=4;
		

Crossrefs

Programs

  • Mathematica
    b = 4; Table[c1 = b^i; cs = {};
    Do[c2 = b^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, 0, i - 1}];
    ct = Length[cs]; ct, {i, 1, 100}]

A232190 a(n) is the number of primes of the form 2^b + 2n +- 2^k +- 1 and 2^(b+2) - 2^b - 2n +- 2^k +- 1, where b is the length of the binary representation of 2n, and 0

Original entry on oeis.org

5, 9, 7, 10, 11, 10, 10, 13, 14, 14, 15, 12, 13, 11, 12, 15, 18, 15, 15, 15, 17, 17, 18, 12, 15, 14, 14, 12, 16, 14, 13, 14, 16, 23, 20, 16, 18, 16, 17, 16, 17, 16, 16, 13, 17, 15, 15, 15, 20, 18, 20, 19, 17, 18, 18, 14, 15, 18, 18, 13, 17, 14, 15, 17, 17, 16
Offset: 1

Views

Author

Lei Zhou, Nov 20 2013

Keywords

Comments

Tested up to n = 1000000000, a(n)> 0.
If any zero terms exist, it is likely that the first one will appear in the interval [2*10^9, 2*10^10].
The terms of this sequence form a bell-shaped distribution with the commonest value of 21 when n is large enough. Up to the first 100 million terms, the range of a(n) is [3..55].

Examples

			When n=1, 2n=2, b=2, the set of numbers of the form 2^b + 2n + 2^k + 1 is {9, 11}; form 2^b + 2n + 2^k - 1: {7, 9}; form 2^b + 2n - 2^k - 1: {1, 3}; form 2^b + 2n - 2^k + 1: {3, 5}; form 2^(b+2) - 2^b - 2n - 2^k - 1: {7, 5}; form 2^(b+2) - 2^b - 2n - 2^k + 1: {9, 7}; form 2^(b+2) - 2^b - 2n + 2^k + 1: {15, 13}; form 2^(b+2) - 2^b - 2n + 2^k - 1: {13, 11}. The union of the above sets is {1, 3, 5, 7, 9, 11, 13, 15}. Among the 8 numbers, 5 are primes. So a(1)=5.
When n=11, using the same rule, the candidate number set is {21, 23, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 105, 107}. Among these 32 numbers, 15 are prime: {23, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 107}. So a(11)=15.
		

Crossrefs

Programs

  • Mathematica
    Table[n2 = 2*n; b = Ceiling[Log[2, n2 + 1]]; sdm = 2^b + n2 - 1;
    sdp = 2^b + n2 + 1; cset = {}; Do[cpmp = sdm + 2^k; cpmm = sdm - 2^k; cppp = sdp + 2^k; cppm = sdp - 2^k; upl = 2^(b + 2); cset = Join[
        cset, {cpmp, upl - cpmp, cpmm, upl - cpmm, cppp, upl - cppp, cppm,
          upl - cppm}], {k, 1, b}]; cset = Union[cset];
    size = Length[cset]; ct = 0;
    Do[If[PrimeQ[cset[[j]]], ct++], {j, 1, size}]; ct, {n, 1, 66}]

Extensions

Edited by Jon E. Schoenfield, Mar 28 2015

A196779 a(n) is the smallest number m such that no prime takes the form of n^m+/-n^k+/-1, while 0 <= k < m and m > 1.

Original entry on oeis.org

1147, 113, 113, 400, 866, 131, 399, 32, 26, 29, 23, 58, 77, 21, 42, 3, 817, 4, 2, 37, 80, 29, 181, 39, 120, 382, 76, 5, 29, 20, 48, 19, 36, 7, 43, 7, 62, 22, 7, 43, 5, 17, 23, 44, 52, 137, 103, 2, 5, 49, 31, 10, 30, 5, 25, 25, 49, 10, 72, 50, 13, 4, 7, 6
Offset: 5

Views

Author

Lei Zhou, Oct 06 2011

Keywords

Comments

Conjecture: a(n) has finite value when a>4
already tested: a(4)>2364; a(3)>7399; and a(2)>9594.
Hypothesis is that a(2), a(3), and a(4) are infinite.
Mathematica program ran about an hour and gave the first 96 items.
When n is larger, a(n) tends to be 2 for most of n.

Examples

			n=5, there is no prime number in the form of 5^1147+/-5^k+/-1 for 0 <= k < 1147
		

Crossrefs

Programs

  • Mathematica
    Table[i = 1;  While[i++; c1 = b^i; cs = {};
      Do[c2 = b^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, 0, i - 1}];
      ct = Length[cs]; ct > 0]; i, {b, 5, 100}]
Showing 1-6 of 6 results.