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.

User: Abhiram R Devesh

Abhiram R Devesh's wiki page.

Abhiram R Devesh has authored 70 sequences. Here are the ten most recent ones:

A383504 Sum of next a(n) successive prime squares is prime.

Original entry on oeis.org

2, 5, 7, 25, 11, 13, 7, 7, 35, 7, 19, 31, 25, 11, 5, 19, 5, 11, 5, 139, 37, 17, 19, 19, 13, 5, 7, 7, 19, 13, 11, 5, 7, 11, 5, 5, 5, 13, 47, 43, 5, 23, 13, 11, 11, 79, 31, 35, 5, 5, 25, 5, 37, 95, 31, 13, 43, 17, 5, 35, 17, 23, 11, 41, 59, 7, 47, 5, 13, 7, 11
Offset: 1

Author

Abhiram R Devesh, May 18 2025

Keywords

Comments

Group the primes such that the sum of squares of members of each group is a prime, and each successive group is as short as possible.
Apart from a(1)=2, a(n) is odd and not a multiple of 3.

Examples

			Primes, their squares, and the lengths of blocks which sum to a prime begin,
  primes  2, 3,  5,  7,  11,  13,  17,  19, ...
  squared 4, 9, 25, 49, 121, 169, 289, 361, ...
          \--/  \-------------------/  \--- ...
  sum      13            653
  a(n) =    2             5
		

Crossrefs

Cf. A001248, A073684 (sum of successive primes), A384161 (sum of successive prime cubes).

Programs

  • Maple
    i:= 0: p:= 0: t:= 0: count:= 0: R:= NULL:
    while count < 100 do
      p:= nextprime(p);
      i:= i+1;
      t:= t + p^2;
      if isprime(t) then
        R:= R, i; count:= count+1; i:= 0; t:= 0;
      fi
    od:
    R; # Robert Israel, May 25 2025
  • Mathematica
    p=1;s={};Do[c=0;sm=0;While[!PrimeQ[sm],sm=sm+Prime[p]^2;p++;c++];AppendTo[s,c],{n,71}];s (* James C. McMahon, Jun 09 2025 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        s, i, p = 0, 1, 2
        while True:
            while not(isprime(s:=s+p**2)): i, p = i+1, nextprime(p)
            yield i
            s, i, p = 0, 1, nextprime(p)
    print(list(islice(agen(), 71))) # Michael S. Branicky, May 23 2025

A384161 Sum of next a(n) successive prime cubes is prime.

Original entry on oeis.org

4, 7, 3, 11, 13, 9, 131, 9, 15, 3, 31, 27, 3, 13, 7, 3, 31, 131, 15, 17, 13, 5, 21, 29, 3, 33, 3, 7, 11, 43, 5, 41, 43, 49, 27, 49, 37, 85, 5, 41, 3, 41, 65, 51, 13, 29, 65, 5, 89, 3, 27, 75, 3, 73, 3, 3, 5, 3, 23, 9, 7, 3, 71, 55, 35, 7, 71, 71, 19, 33, 15
Offset: 1

Author

Abhiram R Devesh, May 20 2025

Keywords

Comments

Group the primes such that the sum of cubes of members of each group is a prime, and each successive group is as short as possible.

Examples

			Primes, their cubes and the lengths of the blocks when summed becomes a prime.
Primes 2,  3,   5,   7,   11,   13,   17,   19,    23,    29,    31,    37,    41
Cubes  8, 27, 125, 343, 1331, 2197, 4913, 6859, 12167, 24389, 29791, 50653, 68921
      \--------------/  \------------------------------------------/ \---...
Sum         503                           81647
a(n) =       4                              7
		

Crossrefs

Cf. A030078, A073684 (sum of successive primes), A383504 (sum of successive prime squares).

Programs

  • Maple
    i:= 0: p:= 0: t:= 0: count:= 0: R:= NULL:
    while count < 100 do
      p:= nextprime(p);
      i:= i+1;
      t:= t + p^3;
      if isprime(t) then
        R:= R, i; count:= count+1; i:= 0; t:= 0;
      fi
    od:
    R; # Robert Israel, May 25 2025
  • Mathematica
    p=1;s={};Do[c=0;sm=0;While[!PrimeQ[sm],sm=sm+Prime[p]^3;p++;c++];AppendTo[s,c],{n,71}];s (* James C. McMahon, Jun 09 2025 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        s, i, p = 0, 1, 2
        while True:
            while not(isprime(s:=s+p**3)): i, p = i+1, nextprime(p)
            yield i
            s, i, p = 0, 1, nextprime(p)
    print(list(islice(agen(), 71))) # Michael S. Branicky, May 23 2025

A381868 Starting from the n-th prime, a(n) is the minimum number > 1 of consecutive primes whose sum is the greater of a twin prime pair.

Original entry on oeis.org

2, 137, 95, 3, 339, 93, 51, 5, 49, 5, 3, 115, 91, 35, 331, 7, 11, 3, 19, 29, 5, 187, 515, 15, 13, 79, 203, 11, 3, 69, 9, 93, 7, 13, 13, 5, 189, 71, 289, 419, 35, 239, 11, 9, 9, 33, 3, 129, 57, 75, 71, 53, 23, 121, 523, 13, 11, 3, 9, 11, 3, 193, 87, 5, 23, 181, 115, 3
Offset: 1

Author

Abhiram R Devesh, Mar 08 2025

Keywords

Examples

			a(4) = 3 because we need to add the primes 7, 11 and 13, to reach the greater of the twin prime pair (29 and 31).
		

Crossrefs

Programs

  • Maple
    f:= proc(p) local t,q,i;
      t:= p; q:= p;
      for i from 2 do
        q:= nextprime(q);
        t:= t+q;
        if isprime(t) and isprime(t-2) then return i fi
      od
    end proc:
    seq(f(ithprime(i)),i=1..100); # Robert Israel, May 08 2025
  • PARI
    a(n) = my(p=prime(n), s=p, nb=1); while (!isprime(s-2) || !isprime(s) || (nb==1), p=nextprime(p+1); s+=p; nb++); nb; \\ Michel Marcus, Apr 02 2025
  • Python
    import sympy
    def a(n):
       p=sympy.prime(n); s=p; c=1
       p=sympy.nextprime(p); s+=p; c+=1
       while not(sympy.isprime(s-2) and sympy.isprime(s)):p=sympy.nextprime(p); s+=p; c+=1
       return c
    

A381766 Starting from the n-th prime, a(n) is the minimum number > 1 of consecutive primes whose sum is the average of a twin prime pair.

Original entry on oeis.org

57, 180, 2, 2, 4, 2, 8, 2, 100, 2, 16, 18, 26, 12, 160, 4, 70, 70, 2, 12, 6, 4, 76, 202, 2, 4, 4, 10, 24, 2, 14, 18, 22, 8, 8, 48, 4, 72, 132, 224, 180, 142, 10, 96, 24, 10, 24, 124, 76, 2, 164, 34, 196, 120, 34, 24, 128, 118, 8, 6, 34, 2, 2, 8, 116, 18, 552, 6
Offset: 1

Author

Abhiram R Devesh, Mar 08 2025

Keywords

Examples

			a(3) = 2 because we need to add 5 and 7, to reach the average of the twin primes 11 and 13, which is 12.
		

Crossrefs

Programs

  • Maple
    A381766 := proc(n)
        local p ,a, ps;
        p := ithprime(n) ;
        ps := p ;
        for a from 2 do
            p := nextprime(p) ;
            ps := ps+p ;
            if isprime(ps-1) and isprime(ps+1) then
                return a;
            end if;
        end do:
    end proc:
    seq(A381766(n),n=1..20) ; # R. J. Mathar, Apr 02 2025
  • PARI
    a(n) = my(p=prime(n), s=p, nb=1); while (!isprime(s-1) || !isprime(s+1), p=nextprime(p+1); s+=p; nb++); nb; \\ Michel Marcus, Apr 02 2025
  • Python
    import sympy
    def a(n):
       p=sympy.prime(n);s=p;c=1
       while not(sympy.isprime(s-1) and sympy.isprime(s+1)):p=sympy.nextprime(p);s+=p;c+=1
       return c
    

A381855 Starting from prime(n), a(n) is the minimum number > 1 of consecutive primes whose sum is the lesser of a twin prime pair.

Original entry on oeis.org

2, 95, 317, 23, 3, 5, 3, 3, 277, 7, 7, 25, 35, 237, 7, 5, 17, 41, 15, 33, 23, 7, 3, 111, 257, 3, 7, 57, 5, 11, 57, 13, 11, 79, 45, 67, 29, 97, 11, 15, 15, 21, 113, 19, 35, 15, 9, 5, 123, 29, 59, 27, 19, 227, 223, 37, 279, 53, 41, 3, 135, 53, 143, 81, 41, 29, 39, 63
Offset: 1

Author

Abhiram R Devesh, Mar 08 2025

Keywords

Examples

			a(1) = 2 because we need to add the primes 2 and 3, to reach the lesser of the twin prime pair (5 and 7).
		

Crossrefs

Cf. A001359.

Programs

  • PARI
    a(n) = my(p=prime(n), q=nextprime(p+1), s = p+q, k=2); while (!(isprime(s) && isprime(s+2)), q=nextprime(q+1); s+=q; k++); k; \\ Michel Marcus, Mar 09 2025
  • Python
    import sympy
    def a(n):
       p=sympy.prime(n);s=p;c=1
       p=sympy.nextprime(p);s+=p;c+=1
       while not(sympy.isprime(s)and sympy.isprime(s+2)):p=sympy.nextprime(p);s+=p;c+=1
       return c
    

A373316 Numbers k such that k and k+2 are both primitive abundant numbers.

Original entry on oeis.org

18, 102, 364, 366, 474, 532, 642, 834, 1036, 1146, 1182, 1374, 1504, 1696, 1876, 1986, 2210, 2584, 2994, 3052, 3126, 3556, 4396, 4542, 4564, 5032, 5514, 5572, 5574, 5622, 6232, 6412, 6522, 6976, 7026, 7206, 7912, 7924, 8202, 8596, 8706, 9654, 9714
Offset: 1

Author

Abhiram R Devesh, May 31 2024

Keywords

Examples

			18 = 2*3*3 is an abundant number, but its proper divisors are 1, 2, 3, 6 and 9, none of which are abundant.
18 + 2 = 20 = 2*2*5 is an abundant number, but its proper divisors are 1, 2, 4, 5 and 10, none of which are abundant.
Thus, both 18 and 20 are primitive abundant numbers, so 18 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    f1[p_, e_] := (p^(e + 1) - 1)/(p^(e + 1) - p^e); f2[p_, e_] := (p^(e + 1) - p)/(p^(e + 1) - 1); primAbQ[n_] := primAbQ[n] = (r = Times @@ f1 @@@ (f = FactorInteger[n])) > 2 && r * Max @@ f2 @@@ f <= 2; Select[Range[2, 10^4], primAbQ[#] && primAbQ[# + 2] &] (* Amiram Eldar, Jul 20 2024 *)

A282400 Primes of the form n^2*2^n + 1.

Original entry on oeis.org

3, 17, 73, 257, 924844033, 966367641601, 9354438770689, 468230246058455728129, 12676506002282294014967032053760001, 112418056545792871256481555812420390351647277057, 462428252436731001462884654101636424188009906177, 32113073085884097323811434312613640568611799040001
Offset: 1

Author

Abhiram R Devesh, Feb 19 2017

Keywords

Crossrefs

Subset of A248917.
Cf. A058780 Numbers n such that n^2 * 2^n + 1 is prime.
Cf. A279904 Primes of the form n^2*2^n - 1.

Programs

  • Mathematica
    Select[Table[n^2 2^n+1,{n,200}],PrimeQ] (* Harvey P. Dale, Mar 26 2023 *)
  • Python
    import sympy
    n = 1
    while n < 100:
        q = (n**2) * (2**n) + 1
        if sympy.isprime(q):
            print(q)
        n += 1

A275968 Smaller of two consecutive primes p and q such that c(p) = c(q), where c(n) = A008908(n) is the length of x, f(x), f(f(x)), ... , 1 in the Collatz conjecture.

Original entry on oeis.org

173, 409, 419, 421, 439, 487, 521, 557, 571, 617, 761, 887, 919, 1009, 1039, 1117, 1153, 1171, 1217, 1327, 1373, 1549, 1559, 1571, 1657, 1693, 1709, 1721, 1733, 1783, 1831, 1861, 1901, 1993, 1997, 2053, 2089, 2339, 2393, 2521, 2539, 2647, 2657, 2677, 2693, 2777
Offset: 1

Author

Abhiram R Devesh, Aug 15 2016

Keywords

Comments

If x is even f(x) = x/2 else f(x) = 3x + 1.

Examples

			a(1) = p = 173; q = 179
c(p) = c(q) = 32
		

Crossrefs

Cf. A006577 (Collatz trajectory lengths), A078417, A008908.

Programs

  • Mathematica
    t = Table[Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # != 1 &] - 1, {n, 10^4}]; Prime@ Flatten@ Position[#, k_ /; Length@ k == 1] &@ Map[Union@ Part[t, #] &, #] &@ Partition[#, 2, 1] &@ Prime@ Range@ 410 (* Michael De Vlieger, Sep 01 2016 *)
  • PARI
    A008908(n)=my(c=1); while(n>1, n=if(n%2, 3*n+1, n/2); c++); c
    t=A008908(p=2); forprime(q=3,1e4, tt=A008908(q); if(t==tt, print1(p", ")); p=q; t=tt) \\ Charles R Greathouse IV, Sep 01 2016
    
  • Python
    import sympy
    def lcs(n):
        a=1
        while n>1:
            if n%2==0:
                n=n//2
            else:
                n=(3*n)+1
            a=a+1
        return(a)
    m=2
    while m>0:
        n=sympy.nextprime(m)
        if lcs(m)==lcs(n):
            print(m,)
        m=n
    # Abhiram R Devesh, Sep 02 2016

A260802 Odd numbers x = 2n - 1 such that the concatenation of A019519(n) and A038395(n-1) is prime.

Original entry on oeis.org

3, 13, 19, 21, 67
Offset: 1

Author

Abhiram R Devesh, Jul 31 2015

Keywords

Examples

			a(1) = 3 since 13_1 is prime;
a(2) = 13 since 135791113_1197531 is prime;
a(3) = 19 since 135791113151719_1715131197531 is prime.
		

Crossrefs

Programs

  • Python
    import sympy
    n=1
    while n>0:
        s=str(n)
        for m in range(n-2,0,-2):
            s=str(m)+s+str(m)
        p=int(s)
        if sympy.isprime(p)==True:
            print(n)
        n=n+2

A270884 Smallest of 4 consecutive prime numbers that when represented as a simple continued fraction, generates prime numbers in the numerator and denominator, when reduced.

Original entry on oeis.org

41, 367, 619, 659, 701, 2267, 2789, 3253, 3463, 6917, 8969, 9221, 11959, 13499, 14431, 17359, 17851, 20143, 22283, 23669, 26107, 27847, 28547, 28879, 29537, 32503, 32717, 32987, 37549, 40709, 40849, 41647, 45971, 47161, 49339, 51061, 51199, 52571, 53171, 53479, 58337
Offset: 1

Author

Abhiram R Devesh, Mar 25 2016

Keywords

Comments

Order in which the simple continued fraction generated is important. In this case increasing order.

Examples

			For a = 41, the set is [41, 43, 47, 53] in simple continued fraction is
41 +       1
     ----------------
       43  +    1
            ---------
             47 + 1
                 ----
                  53
When reduced 4398061/107209; where 4398061 and 107209 are both primes.
		

Programs

  • Mathematica
    Select[Prime@ Range[10^4], AllTrue[{Numerator@ #, Denominator@ #} &@ FromContinuedFraction@ Prime@ Range[#, # + 3] &@ PrimePi@ #, PrimeQ] &] (* Michael De Vlieger, Apr 02 2016, Version 10 *)
    cfpnQ[lst_]:=Module[{fcf=FromContinuedFraction[lst]},AllTrue[{Numerator[ fcf],Denominator[ fcf]},PrimeQ]]; Select[Partition[Prime[ Range[ 5000]],4,1],cfpnQ][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 06 2020 *)