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: Pierandrea Formusa

Pierandrea Formusa's wiki page.

Pierandrea Formusa has authored 28 sequences. Here are the ten most recent ones:

A323026 Zeroless pandigital numbers that are between two twin primes.

Original entry on oeis.org

123457968, 123459768, 123946578, 124397658, 124936578, 124953678, 125347698, 125437968, 125463798, 125674398, 126345978, 126495738, 126593478, 126597348, 126945738, 127394568, 127396458, 127453968, 127459638, 127659438, 129357648, 129635478, 129673548, 132564978, 132594768, 132769458
Offset: 1

Author

Pierandrea Formusa, Jan 02 2019

Keywords

Comments

Intersection of A050289 and A014574.
The definition permits repeated digits. - N. J. A. Sloane, May 16 2023
a(n) mod 10 is either 2 or 8. First term with a(n) mod 10 = 2 is a(27) = 134756982. - Chai Wah Wu, Jan 27 2019
There are 2595 terms that are pandigital without repeating any digit. - Harvey P. Dale, Jan 25 2021

Crossrefs

Cf. A050289 (zeroless pandigital numbers), A014574 (average of twin primes).

Programs

  • PARI
    isok(n) = my(d=digits(n)); vecmin(d) && (#Set(d)==9) && isprime(n-1) && isprime(n+1);
    for (n=123456789, 133000000, if (isok(n), print1(n, ", "))) \\ Michel Marcus, Jan 04 2019
    
  • Python
    import itertools
    from sympy import isprime
    nmax=pow(10,10)
    r=""
    li=[]
    def is_pandigit_easy(n):
        l=[]
        s=str(n)
        if '0' in s: return(False)
        for ch in s:
            if ch not in l: l.append(ch)
        l=list(set(l))
        if len(l)==9:
            return(True)
        else:
            return(False)
    t=0
    tmax=50
    for i in range(123456789,nmax):
        if is_pandigit_easy(i):
            if isprime(i-1) and isprime(i+1):
                li.append(i)
                t+=1
                if t>tmax: break
    first_elem=26
    for k in li[:first_elem]:
          r=r+","+str(k)
    print(r[1:])
    
  • Python
    from itertools import permutations
    from sympy import isprime
    A323026_list = [n for n in (int(''.join(s)) for s in permutations('123456789')) if isprime(n-1) and isprime(n+1)] # Chai Wah Wu, Jan 27 2019

A322525 Numbers such that the list of exponents of their factorization is a palindromic list of primes.

Original entry on oeis.org

2700, 5292, 9000, 13068, 18252, 24300, 24500, 24696, 31212, 38988, 47628, 55125, 57132, 60500, 68600, 84500, 90828, 95832, 103788, 117612, 136125, 144500, 147852, 158184, 164268, 166012, 180500, 181548, 190125, 199692, 218700, 231525, 231868, 238572, 243000, 264500, 266200, 280908, 303372, 325125
Offset: 1

Author

Pierandrea Formusa, Dec 13 2018

Keywords

Comments

I mean nontrivial palindrome: more than one number and not all equal numbers.
Factorization is meant to produce p1^e1*...*pk^ek, with pi in increasing order.

Examples

			9000 is a term as 9000=2^3*3^2*5^3 and the correspondent exponents list [3,2,3] is a palindromic list of primes.
		

Crossrefs

Subsequence of A242414.

Programs

  • Mathematica
    aQ[s_] := Length[Union[s]]>1 && AllTrue[s, PrimeQ] && PalindromeQ[s]; Select[Range[1000], aQ[FactorInteger[#][[;;,2]]] &] (* Amiram Eldar, Dec 14 2018 *)
  • PARI
    isok(n) = (ve=factor(n)[,2]~) && (Vecrev(ve)==ve) && (#ve>1) && (#Set(ve)>1) && (#select(x->(!isprime(x)), ve) == 0); \\ Michel Marcus, Dec 14 2018
  • Python
    from sympy.ntheory import factorint,isprime
    def all_prime(l):
        for i in l:
            if not(isprime(i)): return(False)
        return(True)
    def all_equal(l):
        ll=len(l)
        set_l=set(l)
        lsl=list(set_l)
        llsl=len(lsl)
        return(llsl==1)
    def pal(l):
        return(l == l[::-1])
    n=350000
    r=""
    lp=[]
    lexp=[]
    def calc(n):
        global lp,lexp
        a=factorint(n)
        lp=[]
        for p in a.keys():
            lp.append(p)
        lexp=[]
        for exp in a.values():
            lexp.append(exp)
        return
    for i in range(4,n):
        calc(i)
        if len(lexp)>1:
            if all_prime(lexp):
                if not(all_equal(lexp)):
                    if pal(lexp):
                        r += ","+str(i)
    print(r[1:])
    

A321890 Primes of the form p^2 + 16 where p is prime.

Original entry on oeis.org

41, 137, 857, 977, 1697, 6257, 7937, 11897, 22817, 32057, 36497, 44537, 52457, 78977, 96737, 151337, 160817, 177257, 192737, 249017, 326057, 361217, 434297, 477497, 491417, 516977, 546137, 564017, 591377, 674057, 737897, 776177, 885497, 942857, 982097, 1018097
Offset: 1

Author

Pierandrea Formusa, Nov 20 2018

Keywords

Comments

Also primes of the form p^2 + q^4 where p and q are primes. The proof of the equivalence of the set of primes p^2 + q^4, where p and q are primes, with respect to this sequence, is the following: Exactly 1 of (p, q) giving a term is 2. q^4 + 4 is divisible by 5 and/or composite and gives no terms. - David A. Corneth, Nov 21 2018

Examples

			41 is prime and 41 = 5^2 + 16, where 5 is prime, therefore 41 is a term.
		

Programs

  • Maple
    select(isprime,[ithprime(p)^2+16$p=1..180]); # Muniru A Asiru, Nov 24 2018
  • Mathematica
    Select[Prime[Range[100]]^2+16, PrimeQ] (* Amiram Eldar, Nov 21 2018 *)
  • MiniZinc
    include "globals.mzn";
    int: n = 1;
    int: max_val = 1200000;
    array[1..n+1] of var 2..max_val: x;
    % primes between 2..max_valset of int:
    prime = 2..max_val diff { i | i in 2..max_val, j in 2..ceil(sqrt(i)) where i mod j = 0} ;
    set of int: primes;primes = prime union {2};
    solve satisfy;
    constraint all_different(x) /\ x[1] in primes /\ x[2] in primes /\
    pow(x[1],2)+16= x[2] ;
    output [ show(x)]
    
  • PARI
    upto(n) = my(res = List()); forprime(p = 3, sqrtint(n-16), if(isprime(p^2 + 16), listput(res, p^2 + 16))); res \\ David A. Corneth, Nov 21 2018

Extensions

More terms from Amiram Eldar, Nov 21 2018

A320342 Maximum term in Cunningham chain of the first kind generated by the n-th prime.

Original entry on oeis.org

47, 7, 47, 7, 47, 13, 17, 19, 47, 59, 31, 37, 167, 43, 47, 107, 59, 61, 67, 71, 73, 79, 167, 2879, 97, 101, 103, 107, 109, 227, 127, 263, 137, 139, 149, 151, 157, 163, 167, 347, 2879, 181, 383, 193, 197, 199, 211, 223, 227, 229, 467, 479, 241, 503, 257, 263, 269, 271, 277, 563, 283, 587, 307, 311, 313, 317, 331, 337, 347, 349
Offset: 1

Author

Pierandrea Formusa, Dec 10 2018

Keywords

Comments

No term is a Sophie Germain prime.
A181697 is the sequence of the lengths of the chains in the name.

Examples

			a(1)=47 as prime(1)=2 and the Cunningham chain generated by 2 is (2,5,11,23,47), with maximum item 47.
		

Crossrefs

Cf. A181697.

Programs

  • Mathematica
    a[n_] := NestWhile[2#+1&, n, PrimeQ, 1, Infinity, -1]; a/@Prime@Range@70  (* Amiram Eldar, Dec 11 2018 *)
  • Python
    def cunningham_chain(p,t):
        # returns the Cunningham chain generated by p of type t (1 or 2)
        from sympy.ntheory import isprime
        if not(isprime(p)):
            raise Exception("Invalid starting number! It must be prime")
        if t!=1 and t!=2:
            raise Exception("Invalid type! It must be 1 or 2")
        elif t==1: k=t
        else: k=-1
        cunn_ch=[]
        cunn_ch.append(p)
        while isprime(2*p+k):
            p=2*p+k
            cunn_ch.append(p)
        return(cunn_ch)
    from sympy import prime
    n=71
    r=""
    for i in range(1,n):
        cunn_ch=(cunningham_chain(prime(i),1))
        last_item=cunn_ch[-1]
        r += ","+str(last_item)
    print(r[1:])

A320393 First members of the Cunningham chains of the first kind whose length is a prime.

Original entry on oeis.org

2, 3, 11, 23, 29, 41, 53, 83, 113, 131, 173, 179, 191, 233, 239, 251, 281, 293, 419, 431, 443, 491, 593, 641, 653, 659, 683, 719, 743, 761, 809, 911, 953, 1013, 1019, 1031, 1049, 1103, 1223, 1289, 1439, 1451, 1481, 1499, 1511, 1559, 1583, 1601, 1733, 1811, 1889, 1901, 1931, 1973, 2003, 2039, 2063, 2069, 2129, 2141
Offset: 1

Author

Pierandrea Formusa, Dec 10 2018

Keywords

Examples

			41 is an item as it generates the Cunningham chain (41, 83, 167), of length 3, that is prime.
		

Crossrefs

Programs

  • Mathematica
    aQ[n_] := PrimeQ[Length[NestWhileList[2#+1&, n, PrimeQ]] - 1]; Select[Range[2200], aQ] (* Amiram Eldar, Dec 11 2018 *)
  • Python
    from sympy.ntheory import isprime
    def cunningham_chain(p,t):
        #it returns the cunningham chain generated by p of type t (1 or 2)
        if not(isprime(p)):
            raise Exception("Invalid starting number! It must be prime")
        if t!=1 and t!=2:
            raise Exception("Invalid type! It must be 1 or 2")
        elif t==1: k=t
        else: k=-1
        cunn_ch=[]
        cunn_ch.append(p)
        while isprime(2*p+k):
            p=2*p+k
            cunn_ch.append(p)
        return(cunn_ch)
    from sympy import prime
    n=350
    r=""
    for i in range(1,n):
        cunn_ch=(cunningham_chain(prime(i),1))
        lcunn_ch=len(cunn_ch)
        if isprime(lcunn_ch):
           r += ","+str(prime(i))
    print(r[1:])

A321891 Prime numbers of the form p^3 + q, where p and q are primes.

Original entry on oeis.org

11, 13, 19, 29, 31, 37, 61, 67, 79, 97, 109, 127, 139, 157, 181, 199, 241, 271, 277, 367, 397, 409, 439, 457, 487, 499, 571, 577, 601, 607, 661, 691, 709, 727, 751, 769, 829, 919, 937, 991, 1021, 1039, 1069, 1117, 1171, 1201, 1231, 1237, 1291, 1297, 1327, 1381
Offset: 1

Author

Pierandrea Formusa, Nov 20 2018

Keywords

Comments

For reasons of parity, either p or q must be equal to 2, so this actually is the union of (mostly) "primes of the form p + 8" (A092402) and (rarely) "primes of the form p^3 + 2" (A048636 = 29, 127, 24391, 357913, ...). - M. F. Hasler, Jan 13 2025
Except for 13, these primes are the minimum or maximum prime numbers of the respective decade. - Davide Rotondo, Jan 31 2025

Examples

			37 is prime and 37 = 2^3 + 29, where 2 and 29 are primes, therefore 37 is a term.
		

Crossrefs

Union of A048636 and A092402. - Michel Marcus, Nov 21 2018

Programs

  • Maple
    N:= 2000: # to get terms <= N
    A1:= select(t -> isprime(t) and isprime(t-8), {11,seq(i,i=13 ..N,6)}):
    v:= floor((N-2)^(1/3)):
    B:= select(t -> isprime(t) and isprime(t^3+2), {3,seq(i,i=5..v,6)}):
    sort(convert(A1 union map(t -> t^3+2,B), list)); # Robert Israel, Mar 05 2020
  • Mathematica
    nmax=4; Select[Union[Prime[Range[nmax]]^3 + 2, Prime[Range[Prime[nmax]^3]] + 8], PrimeQ] (* Amiram Eldar, Nov 21 2018 *)
  • MiniZinc
    include "globals.mzn";
    int: n = 2;
    int: max_val = 1200000;
    array[1..n+1] of var 2..max_val: x;
    % primes between 2..max_valset of int:
    prime = 2..max_val diff { i | i in 2..max_val, j in 2..ceil(sqrt(i)) where i mod j = 0} ;
    set of int: primes; primes = prime union {2};
    solve satisfy;
    constraint all_different(x) /\ x[1] in primes /\ x[2] in primes /\ x[3] in primes /\
    pow(x[1], 3)+pow(x[2], 1)= x[3] ;
    output [ show(x)]
    
  • PARI
    list(lim)=my(v=List()); forprime(p=3,sqrtnint((lim\=1)-2,3), if(isprime(p^3+2), listput(v,p^3+2))); forprime(p=11,lim+8, if(isprime(p-8), listput(v,p))); Set(v) \\ Charles R Greathouse IV, Jan 13 2025
    
  • PARI
    select( {is_A321891(n)=isprime(n)&& (isprime(n-8)|| (ispower(n-2, 3, &n)&&isprime(n)))}, [1..1234]) \\ M. F. Hasler, Jan 13 2025

Extensions

More terms from Amiram Eldar, Nov 21 2018

A321456 Numbers k that are divisible by sum(pi)^2+sum(ei) where k=p1^e1*...*pj^ej with pi primes.

Original entry on oeis.org

16, 192, 288, 704, 1470, 2112, 2160, 3168, 3240, 3872, 4096, 4608, 4752, 4860, 5400, 6912, 7128, 7245, 8100, 9295, 10368, 11616, 13500, 15552, 15900, 17424, 21296, 23328, 23850, 26136, 27720, 32830, 34992, 35960, 39600, 39750, 41536, 45584, 52250, 52488, 59400, 62920, 63888, 67200, 78732, 81920, 86430
Offset: 1

Author

Pierandrea Formusa, Nov 18 2018

Keywords

Comments

Numbers k that are divisible by A001222(k)+A235323(k).

Examples

			704 is an item as its prime factorization is 2^6+11^1, sum(pi)=2+11=13, sum(e1)=6+1=7, sum(pi)^2+sum(e1)=13^2+7=169+7=176, finally 704=c*176 for c=4.
		

Crossrefs

Programs

  • Mathematica
    fun[n_] := Module[{f = FactorInteger[n]}, Total@f[[;;, 1]]^2 + Total@f[[;;, 2]]]; aQ[n_] := Divisible[n, fun[n]]; Select[Range[100000], aQ] (* Amiram Eldar, Nov 18 2018 *)
  • PARI
    ok(k)={my(f=factor(k)); k > 1 && k % (vecsum(f[,2]) + vecsum(f[,1])^2) == 0} \\ Andrew Howroyd, Nov 19 2018
  • Python
    from sympy.ntheory import factorint, isprime
    n=100000
    r=""
    def calc(n):
        global r
        a=factorint(n)
        lp=[]
        for p in a.keys():
            lp.append(p)
        lexp=[]
        for exp in a.values():
            lexp.append(exp)
        if n%((sum(lp))**2+sum(lexp))==0:
           r += ","
           r += str(n)
        return
    for i in range(4,n):
        calc(i)
    print(r[1:])
    

A319371 Numbers k such that the characteristic polynomial of a wheel graph of k nodes has exactly one monomial with vanishing coefficient.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 46, 47, 48, 50, 51, 52, 54, 55, 56, 58, 59, 60, 62, 63, 64, 66, 67, 68, 70, 71, 72, 74, 75, 76, 78, 79, 80, 82, 83, 84, 86, 87, 88
Offset: 1

Author

Pierandrea Formusa, Sep 17 2018

Keywords

Comments

For the spectrum of W_n see, e.g., the Wikipedia link. - Wolfdieter Lang, Oct 30 2018

Examples

			4 is a term as the characteristic polynomial of the wheel graph of 4 nodes is x^4 - 6*x^2 - 8*x - 3, in which the monomial of x^3 has null coefficient and no other ones, so this polynomial has exactly one monomial with vanishing coefficient.
5 is not member of this sequence because the eigenvalues of A(W_5) (the adjacency matrix of W_5) has eigenvalues 0, 0, 2, 1 + sqrt(5), 1 - sqrt(5), and the monic characteristic polynomial is x^5 - 8*x^3 - 8*x^2 with three missing monomials x^0, x^1 and x^4. - _Wolfdieter Lang_, Oct 30 2018
		

Crossrefs

Cf. A004772.

Programs

  • Sage
    def how_many_zeros(v):
        t=0
        for el in v:
            if el==0: t += 1
        return t
    r=""
    for i in range(1,100):
            p = graphs.WheelGraph(i)
            cp=p.characteristic_polynomial()
            vcp=(cp.coefficients(sparse=False))
            if how_many_zeros(vcp)==1:
                r=r+","+str(i)
    print(r)

Formula

Conjecture: a(n) = A004772(n) for n> 1. [clarified by Michel Marcus, Apr 16 2019]
Conjectures from Colin Barker, Nov 02 2020: (Start)
G.f.: x*(1 + x + x^2 + x^4) / ((1 - x)^2*(1 + x + x^2)).
a(n) = a(n-1) + a(n-3) - a(n-4) for n>5.
(End)

A319017 Prime numbers which satisfy the regex m1{1,m1}m2{1,m2}m3{1,m3}m4{1,m4}m5{1,m5} where mi are one-digit Lucas numbers.

Original entry on oeis.org

21347, 2213347, 2213447, 21334447, 21344447, 21344777, 22133477, 213334477, 221344477, 2134444777, 22133344447, 221344477777, 2133344447777, 2133347777777, 2213447777777, 22133344447777, 213344447777777, 221333447777777, 22133344447777777
Offset: 1

Author

Pierandrea Formusa, Sep 07 2018

Keywords

Comments

mi=Lucas numbers sequence(i), i.e., m1=2, m2=1, m3=3 and so on.
There are 168 = 2*1*3*4*7 numbers matching this regular expression, of which 19 are prime. - Charles R Greathouse IV, Jan 21 2025

Examples

			The prime number 2213447 belongs to this sequence as 2, 1, 3, 4 and 7 are the one-digit Lucas numbers (ordered as in Lucas number sequence) and each digit k is repeated at most k times (including itself), in accordance with the regex described in the sequence name (2 repeated two times, 1 one time, 3 repeated one time, 4 repeated two times and 7 one time).
The prime number 22133344447777777 is the best example, as each one-digit Lucas number k is repeated exactly k times.
		

Crossrefs

Subsequence of A178550.
Cf. A000032.

A319141 Prime numbers p such that p squared + p reversed is also prime.

Original entry on oeis.org

211, 223, 271, 283, 433, 463, 691, 823, 859, 2017, 2029, 2251, 2269, 2293, 2341, 2347, 2593, 2647, 2833, 2851, 2857, 2887, 4153, 4327, 4507, 4513, 4903, 6091, 6361, 6421, 6481, 6529, 6871, 6949, 8011, 8059, 8161, 8209, 8287, 8419, 8467, 8707, 8803, 8929, 8971
Offset: 1

Author

Pierandrea Formusa, Sep 11 2018

Keywords

Comments

All terms == 1 (mod 6). - Robert Israel, Sep 13 2018

Examples

			271 belongs to this sequence as 271 squared is 73441 and 271 reversed is 172 and the sum of 73441 and 172 is 73613, which is prime.
		

Crossrefs

Cf. A304390.

Programs

  • Maple
    revdigs:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L));
    end proc:
    filter:= t -> isprime(t) and isprime(t^2+revdigs(t)):
    select(filter, [seq(t,t=1..10^4,6)]); # Robert Israel, Sep 13 2018
  • Mathematica
    Select[Prime@Range@1120, PrimeQ[#^2 + FromDigits[Reverse@IntegerDigits@#]] &] (* Vincenzo Librandi, Sep 14 2018 *)
  • PARI
    forprime(p=1, 9000, if(ispseudoprime(p^2 + eval(concat(Vecrev(Str(p))))), print1(p, ", "))) \\ Felix Fröhlich, Sep 12 2018
  • Python
    nmax=10000
    def is_prime(num):
        if num == 0 or num == 1: return(0)
        for k in range(2, num):
           if (num % k) == 0:
               return(0)
        return(1)
    ris = ""
    for i in range(nmax):
        if is_prime(i):
           r=int((str(i)[::-1]))
           t=pow(i,2)+r
           if is_prime(t):
              ris = ris+str(i)+","
    print(ris)