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-10 of 28 results. Next

A104883 a(n) is the smallest number k such that A082467(k) = n.

Original entry on oeis.org

4, 5, 8, 7, 24, 11, 54, 51, 22, 117, 222, 19, 114, 87, 46, 207, 216, 61, 258, 291, 128, 591, 336, 43, 306, 423, 136, 519, 492, 97, 888, 951, 146, 537, 318, 163, 1656, 561, 238, 699, 732, 191, 864, 1365, 286, 1353, 1674, 229, 1422, 1671, 802, 2451, 876, 283, 576, 2577
Offset: 1

Views

Author

Keywords

Comments

This is simply the smallest inverse to A082467. Note that A082467 has offset 4. - N. J. A. Sloane, Jan 15 2020

Crossrefs

Cf. A082467.
Records are in A104884.

Programs

  • Mathematica
    f[n_] := Block[{k}, If[ OddQ[n], k = 2, k = 1]; While[ !PrimeQ[n - k] || !PrimeQ[n + k], k += 2]; k]; t = Table[ f[n], {n, 4, 2600}]; u = Table[0, {60}]; Do[a = t[[n]]; If[a < 61 && u[[a]] == 0, u[[a]] = n + 3], {n, 2597}]; u
  • PARI
    a082467(n) = my(k=1); while(isprime(n-k)*isprime(n+k) == 0, k++); k;
    a(n) = my(k=4); while (a082467(k) != n, k++); k; \\ Michel Marcus, Feb 12 2020

Extensions

Definition corrected by Giovanni Resta. - N. J. A. Sloane, Jan 15 2020

A129301 Records in A082467.

Original entry on oeis.org

1, 2, 4, 6, 12, 24, 30, 33, 36, 42, 60, 75, 84, 87, 90, 93, 102, 117, 120, 135, 138, 168, 180, 183, 210, 228, 300, 333, 369, 474, 486, 525, 621, 720, 792, 810, 846, 1086, 1281, 1305, 1515, 1590, 1617, 1722, 1794
Offset: 1

Views

Author

Klaus Brockhaus, Apr 08 2007

Keywords

Examples

			As can be gathered from A082467, the first six records are A082467(4) = 1, A082467(5) = 2, A082467(7) = 4, A082467(11) = 6, A082467(19) = 12, A082467(43) = 24. Hence a(1) to a(6) are 1, 2, 4, 6, 12, 24.
		

Crossrefs

Cf. A082467, A129302 (where records occur).

Formula

a(n) = A082467(A129302(n)). - Jason Kimberley, Sep 04 2011

A129302 Where records occur in A082467.

Original entry on oeis.org

4, 5, 7, 11, 19, 43, 97, 146, 163, 191, 223, 344, 457, 526, 877, 904, 1049, 1114, 1307, 1736, 1751, 1781, 2129, 2476, 3097, 3551, 5131, 8504, 10342, 10357, 18233, 24776, 40072, 68707, 99719, 125903, 174913, 181267, 371428, 827576, 936118, 1054141
Offset: 1

Views

Author

Klaus Brockhaus, Apr 08 2007

Keywords

Examples

			The sixth record in A082467 is A129301(6) = 24 = A082467(43), hence a(6) = 43.
		

Crossrefs

Cf. A082467, A129301 (records).

A231483 Smallest k > A082467(n) such that n-k and n+k are both prime.

Original entry on oeis.org

9, 8, 15, 18, 7, 12, 15, 10, 15, 18, 7, 28, 15, 10, 27, 12, 7, 24, 15, 8, 21, 18, 5, 30, 15, 8, 27, 24, 11, 18, 9, 10, 15, 30, 13, 18, 15, 10, 21, 30, 7, 42, 21, 10, 33, 18, 7, 30, 21, 10, 9, 18, 11, 30, 27, 8, 33, 24, 11, 48, 21, 8, 21, 30
Offset: 20

Views

Author

Pierre CAMI, Nov 09 2013

Keywords

Comments

Starting at n=20 just because there are some n<20 without solution like for n=19, for the least k (A082467) it start at 4 as no solution for n<4.

Crossrefs

Cf. A082467.

Programs

  • PARI
    a(n) = {k=1; while(isprime(n-k)*isprime(n+k) == 0, k++); k++; while(isprime(n-k)*isprime(n+k) == 0, k++); k; } \\ Michel Marcus, Nov 10 2013

A241686 a(1)=1, a(2)=2, a(3)=3; for n>=4, a(n) = n - A082467(n).

Original entry on oeis.org

1, 2, 3, 3, 3, 5, 3, 5, 7, 7, 5, 11, 7, 11, 13, 13, 11, 17, 7, 17, 19, 13, 17, 19, 19, 23, 23, 19, 17, 29, 19, 23, 29, 31, 29, 31, 31, 29, 37, 37, 29, 41, 19, 41, 43, 31, 41, 43, 37, 47, 43, 43, 47, 47, 43, 53, 53, 43, 47, 59, 43, 53, 59, 61, 59, 61, 61, 53
Offset: 1

Views

Author

Vladimir Shevelev, Apr 27 2014

Keywords

Comments

a(i)=i, i=1,2,3, since A082467 is natural extended as 0 for n=1,2,3. For n>=2, a(n) and 2*n-a(n) are both primes. Sequence {2*n - a(n)} begins 1,2,3,5,7,7,11,11,11,13,17,13,19,17,17,19,23,19,31,...

Crossrefs

Cf. A082467.

Extensions

More terms from Peter J. C. Moses

A138567 Variant of A082467 if we regard 1 as a prime.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 4, 3, 2, 3, 6, 1, 6, 3, 2, 3, 6, 1, 12, 3, 2, 9, 6, 5, 6, 3, 4, 9, 12, 1, 12, 9, 4, 3, 6, 5, 6, 9, 2, 3, 12, 1, 24, 3, 2, 15, 6, 5, 12, 3, 8, 9, 6, 7, 12, 3, 4, 15, 12, 1, 18, 9, 4, 3, 6, 5, 6, 15, 2, 3, 12, 1, 6, 15, 4, 3, 6, 5, 18, 9, 2, 15, 24, 5, 12, 3, 14, 9, 18, 7, 12, 9, 4, 15, 6, 7, 30, 9
Offset: 1

Views

Author

J. S. Brilleaud (jeansebo(AT)yahoo.fr), May 18 2008

Keywords

Extensions

Edited by N. J. A. Sloane, May 18 2008

A047160 For n >= 2, a(n) = smallest number m >= 0 such that n-m and n+m are both primes, or -1 if no such m exists.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 9, 0, 5, 6, 3, 4, 9, 0, 1, 0, 9, 4, 3, 6, 5, 0, 9, 2, 3, 0, 1, 0, 3, 2, 15, 0, 5, 12, 3, 8, 9, 0, 7, 12, 3, 4, 15, 0, 1, 0, 9, 4, 3, 6, 5, 0, 15, 2, 3, 0, 1, 0, 15, 4, 3, 6, 5, 0, 9, 2, 15, 0, 5, 12, 3, 14, 9, 0, 7, 12, 9, 4, 15, 6, 7, 0, 9, 2, 3
Offset: 2

Views

Author

Keywords

Comments

I have confirmed there are no -1 entries through integers to 4.29*10^9 using PARI. - Bill McEachen, Jul 07 2008
From Daniel Forgues, Jul 02 2009: (Start)
Goldbach's Conjecture: for all n >= 2, there are primes (distinct or not) p and q s.t. p+q = 2n. The primes p and q must be equidistant (distance m >= 0) from n: p = n-m and q = n+m, hence p+q = (n-m)+(n+m) = 2n.
Equivalent to Goldbach's Conjecture: for all n >= 2, there are primes p and q equidistant (distance >= 0) from n, where p and q are n when n is prime.
If this conjecture is true, then a(n) will never be set to -1.
Twin Primes Conjecture: there is an infinity of twin primes.
If this conjecture is true, then a(n) will be 1 infinitely often (for which each twin primes pair is (n-1, n+1)).
Since there is an infinity of primes, a(n) = 0 infinitely often (for which n is prime).
(End)
If n is composite, then n and a(n) are coprime, because otherwise n + a(n) would be composite. - Jason Kimberley, Sep 03 2011
From Jianglin Luo, Sep 22 2023: (Start)
a(n) < primepi(n)+sigma(n,0);
a(n) < primepi(primepi(n)+n);
a(n) < primepi(n), for n>344;
a(n) = o(primepi(n)), as n->+oo. (End)
If -1 < a(n) < n-3, then a(n) is divisible by 3 if and only if n is not divisible by 3, and odd if and only if n is even. - Robert Israel, Oct 05 2023

Examples

			16-3=13 and 16+3=19 are primes, so a(16)=3.
		

Crossrefs

Programs

  • Haskell
    a047160 n = if null ms then -1 else head ms
                where ms = [m | m <- [0 .. n - 1],
                                a010051' (n - m) == 1, a010051' (n + m) == 1]
    -- Reinhard Zumkeller, Aug 10 2014
    
  • Magma
    A047160:=func;[A047160(n):n in[2..100]]; // Jason Kimberley, Sep 02 2011
    
  • Mathematica
    Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, -1, k], {n, 2, 100}]
    smm[n_]:=Module[{m=0},While[AnyTrue[n+{m,-m},CompositeQ],m++];m]; Array[smm,100,2] (* Harvey P. Dale, Nov 16 2024 *)
  • PARI
    a(n)=forprime(p=n,2*n, if(isprime(2*n-p), return(p-n))); -1 \\ Charles R Greathouse IV, Jun 23 2017
  • UBASIC
    10 N=2// 20 M=0// 30 if and{prmdiv(N-M)=N-M,prmdiv(N+M)=N+M} then print M;:goto 50// 40 inc M:goto 30// 50 inc N: if N>130 then stop// 60 goto 20
    

Formula

a(n) = n - A112823(n).
a(n) = A082467(n) * A005171(n), for n > 3. - Jason Kimberley, Jun 25 2012

Extensions

More terms from Patrick De Geest, May 15 1999
Deleted a comment. - T. D. Noe, Jan 22 2009
Comment corrected and definition edited by Daniel Forgues, Jul 08 2009

A078611 Radius of the shortest interval (of positive length) centered at prime(n) that has prime endpoints.

Original entry on oeis.org

2, 4, 6, 6, 6, 12, 6, 12, 12, 6, 12, 24, 6, 6, 12, 18, 6, 12, 6, 18, 24, 18, 30, 12, 6, 6, 30, 24, 24, 18, 30, 12, 18, 12, 6, 36, 30, 6, 12, 18, 42, 30, 30, 42, 12, 60, 30, 48, 6, 12, 30, 12, 6, 6, 12, 42, 6, 12, 54, 24, 24, 42, 36, 36, 18, 30, 36, 18, 6, 42, 30, 6, 30, 36, 30, 24, 18, 12
Offset: 3

Views

Author

Joseph L. Pe, Dec 09 2002

Keywords

Comments

a(1) and a(2) are undefined. Alternatively, a(n) = least k, 1 < k < n, such that prime(n) + k and prime(n) - k are both prime. I conjecture that a(n) is defined for all n > 2. Equivalently, every prime > 3 is the average of two distinct primes.
a(n) embodies the difference between weak and strong Goldbach conjectures, and therefore between A047160 and A082467 which differ only for prime arguments (a(n)=A082467(prime(n)), while A047160(prime(n))=0). - Stanislav Sykora, Mar 14 2014

Examples

			prime(3) = 5 is the center of the interval [3,7] that has prime endpoints; this interval has radius = 7-5 = 2. Hence a(3) = 2. prime(5) = 11 is the center of the interval [5,17] that has prime endpoints; this interval has radius = 17-11 = 6. Hence a(5) = 6.
		

Crossrefs

Cf. A047160, A082467. - Stanislav Sykora, Mar 14 2014

Programs

  • Mathematica
    f[n_] := Module[{p, k}, p = Prime[n]; k = 1; While[(k < p) && (! PrimeQ[p - k] || ! PrimeQ[p + k]), k = k + 1]; k]; Table[f[i], {i, 3, 103}]
  • PARI
    StrongGoldbachForPrimes(nmax)= {local(v,i,p,k);v=vector(nmax); for (i=1,nmax,p=prime(i);v[i] = -1; for (k=1,p-2,if (isprime(p-k)&&isprime(p+k),v[i]=k;break;););); return (v);} \\ Stanislav Sykora, Mar 14 2014

Formula

a(n) = A082467(A000040(n)). - Jason Kimberley, Jun 25 2012

A087712 a(1) = 1; if n = k-th prime, a(n) = k; otherwise write all prime factors of n in nondecreasing order, replace each prime with its rank, and concatenate the ranks.

Original entry on oeis.org

1, 1, 2, 11, 3, 12, 4, 111, 22, 13, 5, 112, 6, 14, 23, 1111, 7, 122, 8, 113, 24, 15, 9, 1112, 33, 16, 222, 114, 10, 123, 11, 11111, 25, 17, 34, 1122, 12, 18, 26, 1113, 13, 124, 14, 115, 223, 19, 15, 11112, 44, 133, 27, 116, 16, 1222, 35, 1114, 28, 110, 17, 1123, 18
Offset: 1

Views

Author

Eric Angelini, Feb 02 2009

Keywords

Comments

Concatenations of consecutive entries of A112798. - R. J. Mathar, Feb 09 2009
The old entry with this A-number was a duplicate of A082467.

Examples

			n = 2 = first prime, a(2) = 1.
n = 3 = second prime, a(3) = 2.
n = 4 = 2*2 -> 1,1 -> 11, so a(4) = 11.
n = 6 = 2*3 -> 1,2 -> 12, so a(6) = 12.
n = 12 = 2*2*3 -> 1,1,2 -> 112, so a(12) = 112.
		

Crossrefs

See A098282 for lengths of trajectories. Cf. A077960, A156055.

Programs

  • Haskell
    a087712 1 = 1
    a087712 n = read $ concatMap (show . a049084) $ a027746_row n :: Integer
    -- Reinhard Zumkeller, Oct 03 2012
    
  • Maple
    # Maple program from R. J. Mathar, Feb 08 2009: (Start)
    cat2 := proc(a,b) a*10^(max(1,ilog10(b)+1))+b ; end:
    A049084 := proc(p) if isprime(p) then numtheory[pi](p) ; else 0 ; fi; end:
    A087712 := proc(n) local pf,a,p,ex ; if isprime(n) then A049084(n) ; elif n = 1 then 1 ; else pf := ifactors(n)[2] ; a := 0 ; for p in pf do for ex from 1 to op(2,p) do a := cat2(a, A049084(op(1,p)) ) ; od: od: fi; end:
    seq(A087712(n),n=1..140); # (End)
    # (Maple program from David Applegate and N. J. A. Sloane, Feb 09 2009)
    with(numtheory):
    f := proc(n) local t1, v, r, x, j;
    if (n = 1) then return 1; end if;
    t1 := ifactors(n): v := 0;
    for x in op(2,t1) do r := pi(x[1]):
    for j from 1 to x[2] do
    v := v * 10^length(r) + r;
    end do; end do; v; end proc;
  • Mathematica
    f[n_] := If[n == 1, 1, FromDigits@ Flatten[ IntegerDigits@# & /@ (PrimePi@# & /@ Flatten[ Table[ First@#, {Last@#}] & /@ FactorInteger@ n])]]; Array[f, 61] (* Robert G. Wilson v, Jun 06 2011 *)
  • Python
    from sympy import factorint, primepi
    def a(n):
        if n == 1: return 1
        return int("".join(str(primepi(p))*e for p, e in factorint(n).items()))
    print([a(n) for n in range(1, 62)]) # Michael S. Branicky, Oct 01 2024

Extensions

More terms from R. J. Mathar (Feb 08 2009) and independently from David Applegate and N. J. A. Sloane, Feb 09 2009

A078496 Smallest prime p such that p>n and 2*n-p is also prime.

Original entry on oeis.org

5, 7, 7, 11, 11, 11, 13, 17, 13, 19, 17, 17, 19, 23, 19, 31, 23, 23, 31, 29, 29, 31, 29, 31, 37, 41, 31, 43, 41, 37, 37, 41, 41, 43, 47, 41, 43, 53, 43, 67, 47, 47, 61, 53, 53, 61, 53, 59, 61, 59, 61, 67, 59, 61, 73, 71, 61, 79, 71, 67, 67, 71, 71, 73, 83, 71, 73, 83, 73, 79
Offset: 4

Views

Author

Serhat Sevki Dincer (sevki(AT)ug.bilkent.edu.tr), Nov 26 2002

Keywords

Comments

Suggested by Goldbach Conjecture.
Values of q from A143697. This follows from the factorization n^2-k^2 = (n-k)(n+k).

Examples

			a(11)=17.
		

Crossrefs

a(n) = 2n - A078587(n).

Programs

  • Mathematica
    Table[p=n+1; q=2n-p; While[q>0&&!(PrimeQ[p]&&PrimeQ[q]), p++; q-- ]; p, {n, 4, 100}]
  • PARI
    a(n) = {my(p=nextprime(n+1)); while(!isprime(2*n-p), p = nextprime(p+1)); p;} \\ Michel Marcus, Oct 22 2016

Formula

n>3 integer; a(n)=min{p: p>n; p, 2*n-p are primes}.

Extensions

Edited by N. J. A. Sloane, Jan 24 2009 at the suggestion of R. J. Mathar and T. D. Noe.
Showing 1-10 of 28 results. Next