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: S. Brunner

S. Brunner's wiki page.

S. Brunner has authored 17 sequences. Here are the ten most recent ones:

A360594 a(n) is the maximum number of locations 0..n-1 which can be visited in a single path starting from i=n-1, where jumps from location i to i +- a(i) are permitted (within 0..n-1) and each location can be visited up to 2 times.

Original entry on oeis.org

0, 2, 1, 2, 4, 3, 8, 1, 2, 2, 4, 2, 8, 5, 4, 6, 13, 14, 14, 13, 13, 16, 22, 3, 17, 16, 20, 13, 13, 24, 22, 15, 24, 15, 14, 17, 14, 4, 15, 18, 23, 26, 28, 13, 16, 30, 28, 14, 15, 17, 16, 19, 16, 33, 18, 33, 32, 35, 39, 38, 40, 38, 39, 39, 36, 39, 38, 39, 41, 52
Offset: 0

Author

S. Brunner, Feb 13 2023

Keywords

Comments

When a location is visited more than once, each such visit counts in a(n).

Examples

			For n=0 there are no locations 0..n-1, so the sole possible path is empty which is a(0) = 0 locations.
For n=1, the sole possible path is location 0 twice, 0 -> 0, which is 2 locations a(1) = 2.
For n=12, a path of a(12) = 8 locations visited starting from n-1 = 11 is:
  11 -> 9 -> 11 -> 9 -> 7 -> 8 -> 10 -> 6
Locations 11 and 9 are visited twice each and the others once.
  i    = 0  1  2  3  4  5  6  7  8  9 10 11
  a(i) = 0, 2, 1, 2, 4, 3, 8, 1, 2, 2, 4, 2
                                    2<----2
                                     ---->2
                              1<----2<----
                               ->2---->4
                           8<----------
		

Crossrefs

Programs

  • Python
    def A(lastn,times=2,mode=0):
      a,n=[0],0
      while n0:
          if len(d[-1])>v: v,o=len(d[-1]),d[-1][:]
          if d[-1][-1]-a[d[-1][-1]]>=0:
            if d[-1].count(d[-1][-1]-a[d[-1][-1]])0: d.append(d[-1][:])
              d[-1].append(d[-1][-1]+a[d[-1][-1]])
              r=1
          if g>0:
            if r>0: d[-2].append(d[-2][-1]-a[d[-2][-1]])
            else: d[-1].append(d[-1][-1]-a[d[-1][-1]])
            r=1
          if r==0: d.pop()
          r,g=0,0
        a.append(v)
        n+=1
        if mode==0: print(n,a[n])
        if mode>0:
          u,q=0,[]
          while u
    				

A360595 a(n) is the maximum number of locations 1..n-1 which can be visited in a single path starting from i = n-1, where jumps from location i to i +- a(i) are permitted (within 1..n-1) and a term can be visited up to three times.

Original entry on oeis.org

0, 3, 1, 2, 2, 12, 1, 2, 2, 4, 2, 10, 15, 1, 2, 2, 4, 2, 10, 20, 1, 2, 2, 4, 2, 10, 13, 8, 2, 10, 2, 15, 7, 15, 25, 17, 53, 1, 2, 2, 4, 2, 10, 65, 1, 2, 2, 4, 2, 10, 13, 8, 2, 10, 2, 15, 7, 15, 72, 1, 2, 2, 4, 2, 10, 24, 18, 52
Offset: 1

Author

S. Brunner, Feb 14 2023

Keywords

Comments

When a location is visited more than once, each such visit counts in a(n).
a(0)=0 is no terms before n=0 so an empty path.

Examples

			For n=6, the following is the longest chain of jumps starting from i = n-1 = 5,
  1  2  3  4  5   location number i
  0, 3, 1, 2, 2   a(i)
        1<----
         ->2
     3<----
      ------->2
        1<----
         ->2
     3<----
      ------->2
        1<----
         ->2
     3<----
It visited the terms 2,1,2,3 three times in a loop, which gives a total of 12 terms, so a(6)=12.
		

Crossrefs

Cf. A360593.

Programs

  • Python
    def A(lastn,times=3,mode=0):
      a,n=[0],0
      while n0:
          if len(d[-1])>v: v,o=len(d[-1]),d[-1][:]
          if d[-1][-1]-a[d[-1][-1]]>=0:
            if d[-1].count(d[-1][-1]-a[d[-1][-1]])0: d.append(d[-1][:])
              d[-1].append(d[-1][-1]+a[d[-1][-1]])
              r=1
          if g>0:
            if r>0: d[-2].append(d[-2][-1]-a[d[-2][-1]])
            else: d[-1].append(d[-1][-1]-a[d[-1][-1]])
            r=1
          if r==0: d.pop()
          r,g=0,0
        a.append(v)
        n+=1
        if mode==0: print(n+1,a[n])
        if mode>0:
          u,q=0,[]
          while u
    				

A360593 Each term a(i) can reach a(i+a(i)) and a(i-a(i)) if these terms exist. a(n) is the greatest number of terms among a(1..n-1) that can be reached by starting at a(n-1) and visiting no term more than once; a(0)=0. See example.

Original entry on oeis.org

0, 1, 2, 2, 4, 2, 6, 2, 7, 5, 6, 6, 9, 10, 10, 6, 8, 7, 9, 8, 11, 8, 12, 14, 12, 14, 19, 16, 19, 14, 14, 16, 14, 21, 14, 16, 21, 14, 14, 16, 14, 18, 14, 16, 21, 21, 19, 21, 22, 22, 21, 23, 24, 24, 29, 29, 22, 26, 24, 28, 24, 26, 31, 24, 31, 34, 24, 30, 34, 29, 39
Offset: 0

Author

S. Brunner, Feb 13 2023

Keywords

Comments

For clarification:
The terms of the sequence so far are written as a one-dimensional grid, and from every term a(i) you can jump back or forth a(i) terms, without i getting < 0 or > n, as these terms don't exist. Then search for the longest possible chain of jumps you can do starting at a(n) and visiting no term more than once. The number of targets visited by this chain is the next term of the sequence.
A chain of jumps C always starts at n, with C1 = a(n-1). Then the first jump always has to go back C1 terms, so C2 = a(n-1-C1) = a(n-1-a(n-1)), and then it continues with jumping back or forth C2 terms, whichever produces the longest chain of jumps:
C3 = a(n-1-C1-C2) or a(n-1-C1+C2),
C4 = a(n-1-C1{-/+}C2{-/+}C3), etc.
The first numbers which appear to be missing from this sequence are:
3, 13, 15, 17, 20, 25, 27, 32, 33, 36, 43, 44, 48, 50, 51, 62, 63, 69, 70, 71, 75, 77, 78, 80, etc.

Examples

			This example shows the longest chain of jumps starting with a(7)=2:
0, 1, 2, 2, 4, 2, 6, 2
   1<----2<----2<----2
    ->2---->4
0<----------
It visited the 7 terms 2,2,2,1,2,4,0. So a(8)=7.
		

Crossrefs

Programs

  • Python
    def A(lastn,times=1,mode=0):
      a,n=[0],0
      while n0:
          if len(d[-1])>v: v,o=len(d[-1]),d[-1][:]
          if d[-1][-1]-a[d[-1][-1]]>=0:
            if d[-1].count(d[-1][-1]-a[d[-1][-1]])0: d.append(d[-1][:])
              d[-1].append(d[-1][-1]+a[d[-1][-1]])
              r=1
          if g>0:
            if r>0: d[-2].append(d[-2][-1]-a[d[-2][-1]])
            else: d[-1].append(d[-1][-1]-a[d[-1][-1]])
            r=1
          if r==0:d.pop()
          r,g=0,0
        a.append(v)
        n+=1
        if mode==0: print(n,a[n])
        if mode>0:
          u,q=0,[]
          while u
    				

A359568 Maximum number of distinct folds after folding a square sheet of paper n times.

Original entry on oeis.org

0, 1, 3, 7, 14, 27, 52
Offset: 0

Author

S. Brunner, Jan 06 2023

Keywords

Comments

All folds have to be straight and go from one edge of the paper to another edge and need to go through all layers of the paper stack on top of each other. If a previous fold is folded in half, it counts as two folds. But if multiple layers of paper are folded at the same time it still counts as only one fold.
Found by hand. The next terms appear to be 101, 198, 391.

Examples

			Folding instructions for all known terms. Repeat all previous steps for larger n:
a(1)=1:   Fold paper from left to right.
a(2)=3:   Fold from top to bottom. Slightly misalign the folding angle, so that the folds can be counted easier.
a(3)=7:   Fold top left corner down to center of paper.
a(4)=14:  Make a fold parallel to the previous fold and above the folded-down corner.
a(5)=27:  Make another fold parallel to the previous fold and repeat for all n > 5.
		

Formula

Conjecture: a(n) = 2*a(n-1) + 4 - n, for n > 2.

A340394 Base-independent home primes: the prime that is finally reached when you treat the prime factors of n in ascending order as digits of a number in base "greatest prime factor + 1" and repeat this until a prime is reached (a(n) = -1 if no prime is ever reached).

Original entry on oeis.org

2, 3, 41, 5, 11, 7, 41, 23, 17, 11, 43, 13, 23, 23, 3407, 17, 47, 19, 89, 31, 47, 23, 1279, 47, 41, 223, 151, 29, 167, 31, 431, 47, 53, 47, 367, 37, 59, 71, 521, 41, 263, 43, 359, 131, 71, 47, 683, 223, 107, 71, 433, 53, 191, 71, 11807, 79, 89, 59, 3023, 61, 167, 223
Offset: 2

Author

S. Brunner, Jan 06 2021

Keywords

Comments

After a prime is reached it repeats itself infinitely. That's why this prime is then called the "home prime": it is the end of the calculation chain for a specific number.

Examples

			For n=4 we get the base-independent home prime 41 through this chain of calculations:
4 = 2 * 2 -> 22_3 (base 3 because 3 = greatest prime factor (2) + 1)
22_3 = 8_10 = 2 * 2 * 2 -> 222_3
222_3 = 26_10 = 2 * 13 -> 2D_14
2D_14 = 41_10, which is a prime. This gives us 41 as our home prime for n = 4, 8, 26 and 41.
		

Crossrefs

Cf. A037274 (home primes).
Cf. A340393.

Programs

  • Maple
    b:= n-> (l-> (m-> add(l[-i]*m^(i-1), i=1..nops(l)))(1+
        max(l)))(map(i-> i[1]$i[2], sort(ifactors(n)[2]))):
    a:= n-> `if`(isprime(n), n, a(b(n))):
    seq(a(n), n=2..77);  # Alois P. Heinz, Jan 09 2021
  • PARI
    f(n) = my(f=factor(n), list=List()); for (k=1, #f~, for (j=1, f[k, 2], listput(list, f[k, 1]))); fromdigits(Vec(list), vecmax(f[, 1])+1); \\ A340393
    a(n) = my(p); while (! isprime(p = f(n)), n = p); p; \\ Michel Marcus, Jan 07 2021

A340393 Treat the prime factors of n in ascending order as digits of a number in base "greatest prime factor + 1" and convert this number back to a decimal number.

Original entry on oeis.org

2, 3, 8, 5, 11, 7, 26, 15, 17, 11, 43, 13, 23, 23, 80, 17, 47, 19, 89, 31, 35, 23, 171, 35, 41, 63, 151, 29, 95, 31, 242, 47, 53, 47, 175, 37, 59, 55, 521, 41, 159, 43, 323, 131, 71, 47, 683, 63, 107, 71, 433, 53, 191, 71, 1175, 79, 89, 59, 527, 61, 95, 223, 728
Offset: 2

Author

S. Brunner, Jan 06 2021

Keywords

Examples

			Some examples for the calculation of a(n):
(For digits 10,11...36 the letters A,B...Z are used.)
    n -> prime factors     -> a(n)(base) -> a(n)(base 10)
    6 -> 2 * 3             ->   23 (4)   ->   11
   20 -> 2 * 2 * 5         ->  225 (6)   ->   89
   33 -> 3 * 11            ->   3B (12)  ->   47
   56 -> 2 * 2 * 2 * 7     -> 2227 (8)   -> 1175
   62 -> 2 * 31            ->   2U (32)  ->   95
   72 -> 2 * 2 * 2 * 3 * 3 ->22233 (4)   ->  687
  100 -> 2 * 2 * 5 * 5     -> 2255 (6)   ->  539
  910 -> 2 * 5 * 7 * 13    -> 257D (14)  -> 6579
		

Crossrefs

Cf. A037274 (home primes), A037276, A340394.

Programs

  • Maple
    a:= n-> (l-> (m-> add(l[-i]*m^(i-1), i=1..nops(l)))(1+
        max(l)))(map(i-> i[1]$i[2], sort(ifactors(n)[2]))):
    seq(a(n), n=2..77);  # Alois P. Heinz, Jan 09 2021
  • PARI
    a(n) = my(f=factor(n), list=List()); for (k=1, #f~, for (j=1, f[k, 2], listput(list, f[k,1]))); fromdigits(Vec(list), vecmax(f[,1])+1); \\ Michel Marcus, Jan 06 2021
  • Python
    def A(startn,lastn=0):
        a,n,lastn=[],startn,max(lastn,startn)
        while n<=lastn:
            i,j,v,m,f=2,0,0,n,[]
            while i
    				
  • Python
    from sympy import factorint
    def fromdigits(d, b):
      n = 0
      for di in d: n *= b; n += di
      return n
    def a(n):
      f = sorted(factorint(n, multiple=True))
      return fromdigits(f, f[-1]+1)
    print([a(n) for n in range(2, 76)]) # Michael S. Branicky, Jan 06 2021
    

Formula

a(p) = p for prime p.

A340000 Solution to stacking stones puzzle (see Comments).

Original entry on oeis.org

1, 17, 33, 46
Offset: 1

Author

S. Brunner, Dec 26 2020

Keywords

Comments

This is a variant of the stepping stone puzzle sequence (A337663), where you start by placing n 1's on an infinite square grid. Then place the numbers 2,3,... in order on the grid, following the rule that the sum of the 8 surrounding cells has to be equal to the number placed on a cell. a(n) is the largest number which can be achieved starting with n 1's. Additionally, there are 2 different new rules in this "stacking stones" sequence:
1. You can "stack" numbers on top of already placed numbers when the sum of the surrounding 8 cells is equal to the new number. The number inside the cell is not added to the sum and is replaced as value of the cell with the new number.
2. The starting 1's have to be at least one cell apart (to avoid a trivial infinite solution).

Examples

			Illustration for a(3)=33:
+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |
|      |      |  18  |  17  |  26  |      |  33  |
|      |      |      |  [4] | [13] |      |      |
+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |
|      |      |      |   1  |   3  |   5  |  28  |
|      |      |      |      |      |      |      |
+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |
|      |  21  |  14  |  27  |   2  |  23  |      |
|      |      |      |  [6] |      | [11] |      |
+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |
|  22  |      |   7  |      |      |   1  |  24  |
|      |      |      |      |      |      | [12] |
+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |
|      |   1  |   8  |  31  |  32  |      |  25  |
|      |      |      | [15] | [16] |      |      |
+------+------+------+------+------+------+------+
|  30  |  29  |      |      |      |      |      |
| [20] | [19] |      |      |      |      |      |
| [10] |  [9] |      |      |      |      |      |
+------+------+------+------+------+------+------+
Illustration for a(4)=46:
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |      |      |      |      |      |
|  32  |      |  37  |  44  |      |      |      |      |      |      |      |      |
|      |      | [15] | [22] |      |      |      |      |      |      |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |      |      |      |      |      |
|  24  |   8  |   7  |      |      |  39  |      |      |      |  42  |      |  29  |
|      |      |      |      |      |      |      |      |      |      |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |  31  |      |      |      |      |      |      |      |      |
|      |  16  |   1  | [13] |  18  |  21  |      |      |      |  41  |   1  |  28  |
|      |      |      |  [6] |      |      |      |      |      |      |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |      |      |      |      |      |
|      |  17  |      |   2  |   3  |      |      |  43  |      |  40  |      |  27  |
|      |      |      |      |      |      |      |      |      | [14] |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |      |      |      |      |      |
|      |  36  |  19  |      |  34  |   4  |   9  |  33  |   1  |  12  |  26  |      |
|      |      |      |      |  [1] |      |      | [10] |      |      |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |      |  46  |      |      |      |
|      |      |      |  20  |      |   5  |      |      | [23] |      |  38  |      |
|      |      |      |      |      |      |      |      | [11] |      |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
|      |      |      |      |      |      |      |      |      |      |      |      |
|      |      |      |  45  |  25  |  30  |  35  |      |      |      |      |      |
|      |      |      |      |      |      |      |      |      |      |      |      |
+------+------+------+------+------+------+------+------+------+------+------+------+
		

Crossrefs

Cf. A337663.

A338789 Lexicographically earliest sequence of positive integers such that the sum of any number of consecutive terms can only repeat as sum of other consecutive terms after two or more terms between them.

Original entry on oeis.org

1, 2, 4, 1, 9, 2, 1, 21, 2, 3, 1, 8, 2, 23, 18, 2, 8, 7, 9, 2, 1, 20, 16, 1, 21, 36, 3, 32, 2, 3, 4, 11, 13, 8, 2, 13, 27, 4, 18, 3, 7, 5, 8, 133, 3, 22, 31, 46, 19, 8, 47, 14, 3, 2, 14, 10, 44, 3, 5, 1, 10, 3, 9, 6, 19, 73, 39, 22, 36, 6, 1, 60, 17, 32, 227, 2, 134, 9, 45, 11, 33, 3, 37, 1, 8, 12, 14, 8, 1, 67
Offset: 1

Author

S. Brunner, Nov 09 2020

Keywords

Examples

			The solution for a(5):
We look through the numbers step by step and if groups with the same sum are less than 2 terms apart they are put in brackets:
   1,2,4,[1],[1?] - not possible
   [1,2],4,[1,2?] - not possible
   1,2,[4],[1,3?] - not possible
   1,2,[4],1,[4?] - not possible
   1,2,[4,1],[5?] - not possible
   1,[2,4],1,[6?] - not possible
   1,[2,4,1],[7?] - not possible
   [1,2,4,1],[8?] - not possible
   1,2,4,1,9?
There are no 2 sums which contradict the definition of this sequence with a(5) = 9, so this is the next term. In this case we knew it must be the solution because the upper bound of a(n) is always the sum of all previous terms + 1.
Another example for a(8) = 21:
  1,2,4,1,9,2,[1],[1?]   ;  1,2,4,1,9,[2],1,[2?]   ;  1,2,4,1,9,[2,1],[3?]
  1,[2,4,1],9,[2,1,4?]   ;  [1,2,4,1],9,[2,1,5?]   ;  1,2,4,1,[9],[2,1,6?]
  1,2,4,[1,9],[2,1,7?]   ;  1,2,4,1,[9],2,[1,8?]   ;  1,2,4,[1,9],2,[1,9?]
  1,2,4,1,[9,2],[1,10?]  ;  1,2,4,1,[9,2],1,[11?]  ;  1,2,4,1,[9,2,1],[12?]
  1,2,4,[1,9,2,1],[13?]  ;  [1,2,4,1,9],[2,1,14?]  ;  1,2,[4,1,9,2],[1,15?]
  1,2,[4,1,9,2],1,[16?]  ;  1,2,[4,1,9,2,1],[17?]  ;  1,[2,4,1,9,2],1,[18?]
  1,[2,4,1,9,2,1],[19?]  ;  [1,2,4,1,9,2,1],[20?]  ;  1,2,4,1,9,2,1,21?
  -> a(8) = 21.
		

Crossrefs

Cf. A002048.

Programs

  • Python
    def A(lastn):
        n,a,chk,nchk=1,[],[],[]
        while n<=lastn:
            i=1
            while i in chk: i+=1
            for x, v in enumerate(chk): chk[x]=v-i
            chk.extend(nchk)
            for x, v in enumerate(nchk): nchk[x]=v+i
            nchk.append(i)
            chk.extend(nchk)
            chk=[x for x in chk if x>0]
            chk=list(set(chk))
            a.append(i)
            print(i)
            n += 1
        return a

A338759 a(n+1) is the maximum number of groups which can be built from the terms in this sequence so far and using each term only once which result in a(n) as their product with a(1) = 1.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 2, 2, 3, 2, 4, 4, 5, 2, 5, 3, 3, 4, 6, 6, 7, 1, 7, 2, 6, 8, 5, 4, 8, 7, 3, 5, 5, 6, 10, 7, 4, 9, 3, 6, 12, 13, 1, 8, 9, 5, 7, 5, 8, 10, 8, 11, 1, 9, 6, 13, 2, 7, 6, 14, 7, 7, 8, 12, 15, 7, 9, 7, 10, 10, 11, 2, 8, 13, 3, 7, 11, 3, 8, 14
Offset: 1

Author

S. Brunner, Nov 07 2020

Keywords

Comments

This sequence is a variant of A332518 without the requirement that all factors have to be consecutive numbers.

Examples

			To get a(n+1), count how many times a(n) appears in the sequence.
For 1 and primes, this is already a(n+1).
For prime squares, also count how many times the prime factor appears in the sequence, divide it by 2 and round it down.
For example, the next term after a(43) = 9 is 3, because 9 appeared 1 time (at a(43) itself) and 3 appeared 5 times, which can arranged in 2 groups of 3 X 3.
For semiprimes, count how many times the semiprime itself appears in the sequence. Then count how many times the 2 factors appear and add the smallest number.
For example, the next term after a(30) = 6 is 8, because 6 appeared 4 times and the factors 2 and 3 appeared 6 and 4 times. We can build 4 groups of 2 X 3 of them.
		

Crossrefs

Cf. A001222 (bigomega), A162247 (all factorizations of n).
Cf. A332518.

A332941 Lexicographically earliest sequence of positive numbers in which no set of consecutive terms sums to a prime.

Original entry on oeis.org

1, 8, 1, 15, 9, 1, 14, 6, 30, 6, 9, 15, 6, 4, 8, 12, 10, 14, 6, 12, 8, 10, 12, 18, 12, 6, 6, 6, 24, 6, 6, 8, 1, 9, 6, 10, 8, 12, 6, 14, 10, 6, 4, 8, 12, 10, 20, 6, 18, 6, 6, 4, 8, 12, 6, 4, 12, 8, 10, 8, 6, 6, 18, 6, 6, 20, 10, 12, 8, 4, 6, 12, 12, 6, 12, 6, 12
Offset: 1

Author

S. Brunner, Mar 03 2020

Keywords

Comments

Terms >= 30 seem to be very rare. Up to a(450000), 30 appears only 7 times: at n = 9, 288, 2507, 15902, 54405, 242728, 425707.
For n <= 450000, the largest term is 32; it appears at n = 335308 and 370687.

Crossrefs

Programs

  • Maple
    s:= proc(i, j) option remember; `if`(i>j, 0, a(j)+s(i, j-1)) end:
    a:= proc(n) option remember; local k; for k while
          ormap(isprime, [k+s(i, n-1)$i=1..n]) do od; k
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 23 2020
  • Mathematica
    s[i_, j_] := s[i, j] = If[i > j, 0, a[j] + s[i, j-1]];
    a[n_] := a[n] = Module[{k}, For[k = 1, AnyTrue[k+Table[s[i, n-1], {i, 1, n}], PrimeQ], k++]; k];
    Array[a, 100] (* Jean-François Alcover, Nov 17 2020, after Alois P. Heinz *)
  • Python
    def A(ee):
        a=[1]
        print(1)
        n=1
        while n<=ee:
            i=1
            while i>0:
                ii=i
                iz=c=0
                while iz<=len(a):
                    c=0
                    if ii>2:
                        for j in range(2, int((ii)**0.5+1.5)):
                            if ii%j==0:
                                c=1
                                break
                    if c==0 and ii>1:
                        break
                    else:
                        iz += 1
                        ii=ii+a[n-iz]
                if c==1:
                    n += 1
                    a.append(i)
                    print(i)
                    break
                if i<4:
                    i=4
                else:
                    i += 1
        return a