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.

A074924 Numbers whose square is the sum of two successive primes.

Original entry on oeis.org

6, 10, 12, 24, 42, 48, 62, 72, 84, 90, 110, 120, 122, 174, 204, 208, 220, 232, 240, 264, 306, 326, 336, 372, 386, 408, 410, 444, 454, 456, 468, 470, 474, 522, 546, 550, 594, 600, 630, 640, 642, 686, 740, 750, 762, 766, 788, 802, 852, 876, 882, 920, 936, 970
Offset: 1

Views

Author

Zak Seidov, Oct 02 2002

Keywords

Examples

			6^2 = 17 + 19, 1610^2 = 1296041 + 1296059.
		

Crossrefs

Square roots of squares in A001043.
Cf. A062703 (the squares), A061275 (lesser of the primes), A064397 (index of that prime).
Cf. A064397 (numbers n such that prime(n) + prime(n+1) is a square), A071220 (prime(n) + prime(n+1) is a cube), A074925 (n^3 is sum of 2 consecutive primes).

Programs

  • Maple
    filter:= proc(n) local t; t:= n^2/2; prevprime(ceil(t)) + nextprime(floor(t)) = n^2 end proc:
    select(filter, [$3..1000]); # Robert Israel, Nov 19 2024
  • Mathematica
    Select[Sqrt[#]&/@(Total/@Partition[Prime[Range[50000]],2,1]),IntegerQ] (* Harvey P. Dale, Oct 04 2014 *)
    f@n_ := Sqrt@Select[(2*Range@n)^2, # == Plus @@ NextPrime[#/2, {-1, 1}] &]; f@485 (* Hans Rudolf Widmer, Nov 19 2024 *)
  • PARI
    is(n)=if(n%2, return(0)); nextprime(n^2/2+1)+precprime(n^2/2)==n^2 \\ Charles R Greathouse IV, Apr 29 2015
    
  • PARI
    select( {is_A074924(n)=!bittest(n=n^2,0) && precprime(n\2)+nextprime(n\/2)==n}, [1..999]) \\ M. F. Hasler, Jan 03 2020
    
  • PARI
    A74924=[6]; apply( A074924(n)={while(n>#A74924, my(N=A74924[#A74924]); until( is_A074924(N+=2),);A74924=concat(A74924,N));A74924[n]}, [1..99]) \\ M. F. Hasler, Jan 03 2020
    
  • Python
    from itertools import count, islice
    from sympy import nextprime, prevprime
    def agen(): # generator of terms
        for k in count(4, step=2):
            kk = k*k
            if prevprime(kk//2+1) + nextprime(kk//2-1) == kk:
                yield k
    print(list(islice(agen(), 54))) # Michael S. Branicky, May 24 2022

Formula

a(n) = sqrt(A062703(n)). - Zak Seidov, May 26 2013
a(n) = A000040(i) + A000040(i+1) with i = A064397(n) = A000720(A061275(n)). - M. F. Hasler, Jan 03 2020

Extensions

Crossrefs section corrected and extended by M. F. Hasler, Jan 03 2020

A179975 Smallest k such that k*10^n is a sum of two successive primes.

Original entry on oeis.org

5, 3, 1, 6, 6, 6, 14, 6, 9, 19, 21, 21, 42, 93, 21, 6, 11, 2, 12, 111, 37, 39, 63, 38, 42, 24, 15, 15, 60, 6, 39, 82, 47, 58, 337, 49, 72, 25, 34, 21, 6, 107, 128, 96, 20, 2, 63, 231, 70, 7, 62, 144, 28, 151, 157, 33, 98, 55, 134, 162, 87, 201, 124, 303, 64, 106, 130, 13, 43
Offset: 0

Views

Author

Zak Seidov, Aug 04 2010

Keywords

Comments

From Robert G. Wilson v, Aug 11 2010: (Start)
A179975 n's such that a(n)=1: 3, 335, ..., .
A179975 First occurrence of k: 3, 18, 2, ???, 1, 4, 50, 162, 9, 335, 17, 19, 68, 7, 27, ..., .
Records: 5, 6, 14, 19, 21, 42, 93, 111, 337, 449, 862, 1049, 1062, 1122, 1280, 2278, 3168, 4290, ..., . (End)

Examples

			a(0)=5 because 5=2+3
a(1)=3 because 30=13+17
a(2)=1 because 100=47+53
a(3)=6 because 6000=2999+3001.
		

Crossrefs

Programs

  • Mathematica
    Join[{5,3},Reap[Do[Do[n=10^m k; If[n==PreviousPrime[n/2]+NextPrime[n/2],Sow[k];Break[]],{k,2000}],{m,2,50}]][[2,1]]]
    f[n_] := Block[{k = 1, tn = 10^n}, While[h = k*tn/2; NextPrime[h, -1] + NextPrime@h != k*tn, k++ ]; k]; f[1] = 3; Array[f, 70, 0] (* Robert G. Wilson v, Aug 11 2010 *)

Extensions

More terms from Robert G. Wilson v, Aug 11 2010

A071220 Numbers n such that prime(n) + prime(n+1) is a cube.

Original entry on oeis.org

2, 28, 1332, 3928, 16886, 157576, 192181, 369440, 378904, 438814, 504718, 539873, 847252, 1291597, 1708511, 1837979, 3416685, 3914319, 5739049, 6021420, 7370101, 7634355, 8608315, 9660008, 10378270, 14797144, 15423070, 18450693
Offset: 1

Views

Author

Labos Elemer, May 17 2002

Keywords

Comments

The corresponding primes are in A061308; n^3 is a sum of two successive primes in A074925.
Prime(n)+ Prime(n+1) is a square in A064397; n^2 is a sum of two successive primes in A074924;

Examples

			28 is in the list because prime(28)+prime(29) = 107+109 =216 = 6^3.
n=1291597: prime(1291597)+prime(1291598) = 344*344*344.
		

Crossrefs

Programs

  • Mathematica
    PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; Do[ If[ n^3 == PrevPrim[Floor[(n^3)/2]] + NextPrim[Floor[(n^3)/2]], Print[ PrimePi[ Floor[(n^3)/2]]]], {n, 2, 10^4}]
    Flatten[Position[Total/@Partition[Prime[Range[20000000]],2,1],?(IntegerQ[ Surd[ #,3]]&)]] (* _Harvey P. Dale, May 28 2014 *)
  • Python
    from _future_ import division
    from sympy import isprime, prevprime, nextprime, primepi
    A071220_list, i = [], 2
    while i < 10**6:
        n = i**3
        m = n//2
        if not isprime(m) and prevprime(m) + nextprime(m) == n:
            A071220_list.append(primepi(m))
        i += 1 # Chai Wah Wu, May 31 2017

Formula

A001043(x)=m^3 for some m; if p(x+1)+p(x) is a cube, then x is here.
a(n) = primepi(A061308(n)). - Michel Marcus, Oct 24 2014

Extensions

Edited and extended by Robert G. Wilson v, Oct 07 2002

A226524 Cubes which are the sum of two consecutive primes.

Original entry on oeis.org

8, 216, 21952, 74088, 373248, 4251528, 5268024, 10648000, 10941048, 12812904, 14886936, 16003008, 25934336, 40707584, 54872000, 59319000, 114791256, 132651000, 199176704, 209584584, 259694072, 269586136, 306182024, 345948408, 373248000, 543338496, 567663552
Offset: 1

Views

Author

K. D. Bajpai, Aug 31 2013

Keywords

Examples

			a(2) = 216: prime(28) + prime(29) = 107 + 109 = 216 = 6^3.
		

Crossrefs

Cubes in A001043.
Cf. A062703 (analog for squares), A061308 (lesser of the consecutive primes), A071220 (index of that prime), A074925 (a(n)^(1/3)).

Programs

  • Maple
    KD: = proc() local a,b,c;  a: = ithprime(n) + ithprime(n+1); b:= evalf(a^(1/3)); if b=floor(b) then RETURN(a):  fi; end: seq(KD(), n=1..1000000);
  • Mathematica
    Select[Total/@Partition[Prime[Range[155*10^5]],2,1],IntegerQ[Surd[#,3]]&] (* or *) stcpQ[n_]:=Module[{p1=NextPrime[Floor[n/2],-1],p2=NextPrime[Ceiling[n/2]]},n==p1+p2]; Select[Range[850]^3,stcpQ] (* The second program is much more efficient than the first. *) (* Harvey P. Dale, May 15 2022 *)
  • PARI
    n=0; forstep(j=2, 55778, 2, c=j^3; c2=c/2; if(precprime(c2)+nextprime(c2)==c, n++; write("b226524.txt", n " " c))) /* Donovan Johnson, Sep 02 2013 */
    
  • PARI
    A226524(n)=A074925(n)^3 \\ M. F. Hasler, Jan 03 2020
    
  • Python
    from itertools import count, islice
    from sympy import nextprime, prevprime
    def agen(): yield from (c for c in (k**3 for k in count(2, step=2)) if prevprime(c//2+1) + nextprime(c//2-1) == c)
    print(list(islice(agen(), 27))) # Michael S. Branicky, May 24 2022

Formula

a(n) = A074925(n)^3 = A000040(i) + A000040(i+1) with i = A071220(n) = A000720(A061308(n)). - M. F. Hasler, Jan 03 2020

Extensions

Edited by M. F. Hasler, Jan 03 2020

A179485 Sums of two successive primes s such that s+-3 are primes.

Original entry on oeis.org

8, 100, 1120, 1220, 1300, 2240, 2380, 2414, 3536, 3634, 4906, 4940, 5566, 5740, 6706, 7240, 8864, 9224, 9394, 10136, 10850, 12040, 12476, 12586, 12920, 13180, 13334, 13754, 14630, 14720, 15134, 16270, 17710, 18430, 18800, 19916, 21014, 21320
Offset: 1

Views

Author

Keywords

Comments

Intersection of A001043 and A087695. - Robert Israel, Oct 25 2017

Examples

			3+5=8,8-3=5(prime),8+3=11(prime),..
		

Crossrefs

Programs

  • Maple
    q:= 2; p:= 3;
    count:= 0:
    while count < 100 do
      q:= p; p:= nextprime(p);
      s:= q+p;
      if isprime(s-3) and isprime(s+3) then
        count:= count+1; A[count]:= s;
      fi
    od:
    seq(A[i],i=1..count); # Robert Israel, Oct 25 2017
  • Mathematica
    q=3;Select[Table[Prime[n]+Prime[n+1],{n,7!}],PrimeQ[ #-q]&&PrimeQ[ #+q]&]
    Select[Total/@Partition[Prime[Range[1400]],2,1],AllTrue[#+{3,-3},PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 04 2018 *)

A226533 a(n) = smallest integer m such that m^n is a sum of two successive primes.

Original entry on oeis.org

5, 6, 2, 150, 22, 82, 2, 258, 70, 30, 42, 18, 2, 12, 262, 58, 460, 36, 552, 24, 318, 344, 450, 54, 274, 88, 36, 92, 90, 188, 554, 20, 404, 700, 240, 6, 136, 262, 578, 222, 2182, 276, 162, 60, 142, 326, 176, 198, 930, 1116
Offset: 1

Views

Author

Zak Seidov, Jun 09 2013

Keywords

Examples

			5^1 = 5 = 2 + 3, 6^2 = 36  = 17 + 19, 2^3 = 8 = 3 + 5, 150^4 =506250000 = 253124999 + 253125001.
		

Crossrefs

a(2) = 6 = A074924(1), a(3) = 2 = A074925(1). Cf. A001043, A001597.

Programs

  • Mathematica
    a[n_] := For[m = 2, True, m++, p = m^n/2 // NextPrime[#, -1]&; q = NextPrime[p]; If[p + q == m^n, Print["a(", n, ") = ", m]; Return[m]]]; Table[a[n], {n, 1, 50}] (* Jean-François Alcover, Jun 10 2013 *)
    tsp[n_]:=Module[{m=1,t},t=m^n;While[NextPrime[t/2]+NextPrime[t/2, -1]! = t,m++;t=m^n];m]; Array[tsp,50] (* Harvey P. Dale, Nov 10 2014 *)
  • PARI
    a(n)=if(n==1,return(5)); my(m=1,M,p); while(1,M=m++^n;p=precprime(M/2); ispseudoprime(M-p) && M-p==nextprime(M/2) && return(m)) \\ Charles R Greathouse IV, Jun 10 2013

Extensions

a(41)-a(50) from Jean-François Alcover, Jun 10 2013
Showing 1-6 of 6 results.