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-4 of 4 results.

A079841 Duplicate of A069869.

Original entry on oeis.org

0, 11, 3, 211, 2111, 0, 112111, 1111211, 0, 11131111, 1121111111, 0, 111211111111, 2111111111111, 0, 31111111111111, 212111111111111, 0, 1111111111111111111, 2111111111111111111, 0, 111111111111111121111, 11111111111111111111111, 0, 211111111111111111111111
Offset: 1

Views

Author

Amarnath Murthy, Feb 16 2003

Keywords

Comments

Name was: Largest prime that is a concatenation of partitions of n; or 0 if no such number exists.

A069870 Smallest prime that can be formed using a partition of n, or 0 if no such prime exists.

Original entry on oeis.org

0, 2, 3, 13, 5, 0, 7, 17, 0, 19, 11, 0, 13, 59, 0, 79, 17, 0, 19, 137, 0, 139, 23, 0, 223, 179, 0, 127, 29, 0, 31, 131, 0, 277, 233, 0, 37, 137, 0, 139, 41, 0, 43, 359, 0, 379, 47, 0, 409, 149, 0, 151, 53, 0, 487, 353, 0, 157, 59, 0, 61, 359, 0, 163, 263, 0, 67, 167, 0, 367, 71, 0
Offset: 1

Views

Author

Amarnath Murthy, Apr 21 2002

Keywords

Examples

			a(4) = 13 as the partitions of 4 are (4), (3, 1), ( 2, 2), (2, 1, 1) (1, 1, 1, 1). The primes that can be formed are 13, 31, 211 and 13 is the smallest prime using a partition.
		

Crossrefs

Cf. A069869.

Programs

  • Mathematica
    f[n_] := If[ PrimeQ@n, n, If[n > 5 && Mod[n, 3] == 0, 0, Block[{len = PartitionsP[n], p = IntegerPartitions[n], t = {}}, Do[ AppendTo[t, Select[FromDigits /@ Join @@@ IntegerDigits /@ Permutations@p[[i]], PrimeQ@# &]], {i, len}]; t = Union@Flatten@t; If[Length@t > 0, Min@t, 0]] ]]; Array[f, 72] (* Robert G. Wilson v, updated by Jean-François Alcover, Jan 29 2014 *)
  • Python
    from collections import Counter
    from sympy.utilities.iterables import partitions, multiset_permutations
    from sympy import isprime
    def A069870(n):
        d = 10**n
        smin, m = n+1, d
        if n==3 or n%3:
            for s in range(1,n+1):
                if s>smin:
                    break
                m = min((k for k in (int(''.join(str(d) for d in a)) for p in partitions(n,m=s) for a in multiset_permutations(Counter(p).elements())) if isprime(k)),default=d)
                if mChai Wah Wu, Feb 21 2024

Extensions

Edited by David Wasserman, May 01 2003
Corrected by T. D. Noe, Nov 15 2006

A113625 Irregular triangle in which the n-th row contains all primes having digit sum n (not containing the digit '0') in increasing order.

Original entry on oeis.org

2, 11, 3, 13, 31, 211, 5, 23, 41, 113, 131, 311, 2111, 7, 43, 61, 151, 223, 241, 313, 331, 421, 1123, 1213, 1231, 1321, 2113, 2131, 2221, 2311, 3121, 4111, 11113, 11131, 11311, 12211, 21121, 21211, 22111, 111121, 111211, 112111, 17, 53, 71, 233, 251, 431, 521
Offset: 2

Views

Author

Amarnath Murthy, Nov 10 2005

Keywords

Comments

The number of primes in the n-th row is A073901(n). The smallest prime in the n-th row is A067180(n). The largest prime in the n-th row is A069869(n).

Examples

			Starting with row 2, the table is
2, 11
3
13, 31, 211
5, 23, 41, 113, 131, 311, 2111
none
7, 43, 61, 151, 223, 241, 313, 331, 421, 1123,...
		

Crossrefs

Cf. A110741 (with contraints on number of digits).

Programs

  • Maple
    with(combinat):
    b:= proc(n, i, l) option remember; `if`(n=0, select(isprime,
          map(x-> parse(cat(x[])), permute(l))), `if`(i<1, [],
          [seq(b(n-i*j, i-1, [l[],i$j])[], j=0..n/i)]))
        end:
    T:= n-> sort(b(n, 9, []))[]:
    seq(T(n), n=2..8);  # Alois P. Heinz, May 25 2013
  • Mathematica
    Table[If[n > 3 && Mod[n, 3] == 0, {}, p = IntegerPartitions[n]; u = {}; Do[t = Permutations[i]; u = Union[u, Select[FromDigits /@ t, PrimeQ]], {i, p}]; u], {n, 2, 14}]

Extensions

Edited, corrected and extended by Stefan Steinerberger, Aug 10 2007
Edited by T. D. Noe, Jan 25 2011

A116381 Number of compositions of n which are prime when concatenated and read as a decimal string.

Original entry on oeis.org

0, 2, 1, 3, 7, 0, 29, 27, 0, 90, 236, 0, 758, 1039, 0, 3949, 9325, 0, 32907, 51243, 0, 184458, 426372, 0, 1552101, 2537233, 0, 9526385, 21117111, 0, 78112040, 134568638, 0, 505079269, 1096046406, 0
Offset: 1

Views

Author

Robert G. Wilson v, Feb 06 2006

Keywords

Examples

			The eight compositions of 4 are 4,13,31,22,112,121,211,1111 of which 3 {13,31,211} are primes.
Primes for n=11 are: 11, 29, 47, 83, 101, 137, 173, 191, 227, 263, 281, 317, 353, 443, 461, 641, 821, 911, 1163, 1181, ..., 131111111, 212111111, 1111111121, 1111211111, 1121111111.
		

Crossrefs

Cf. A069869, A069870; not the same as A073901.

Programs

  • Mathematica
    f[n_] := If[n > 5 && Mod[n, 3] == 0, 0, Block[{len = PartitionsP@ n, p = IntegerPartitions[n], c = 0}, Do[c = c + Length@ Select[ FromDigits /@ Join @@@ IntegerDigits /@ Permutations@ p[[i]], PrimeQ@# &], {i, len}]; c]]; Array[f, 28] (* Robert G. Wilson v, Aug 03 2012 *)
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import partitions, multiset_permutations
    def a(n):
        c = 0
        for p in partitions(n):
            plst = [k for k in p for _ in range(p[k])]
            s = sum(sum(map(int, str(pi))) for pi in plst)
            if s != 3 and s%3 == 0: continue
            for m in multiset_permutations(plst):
                if isprime(int("".join(map(str, m)))):
                    c += 1
        return c
    print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Nov 19 2022
    
  • Python
    from collections import Counter
    from sympy.utilities.iterables import partitions, multiset_permutations
    from sympy import isprime
    def A116381(n): return sum(1 for p in partitions(n) for a in multiset_permutations(Counter(p).elements()) if isprime(int(''.join(str(d) for d in a)))) if n==3 or n%3 else 0 # Chai Wah Wu, Feb 21 2024

Extensions

a(29)-a(33) from Michael S. Branicky, Nov 19 2022
a(34)-a(36) from Michael S. Branicky, Jul 10 2023
Showing 1-4 of 4 results.