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.

A082548 a(n) is the number of values of k such that k can be expressed as the sum of distinct primes with largest prime in the sum equal to prime(n).

Original entry on oeis.org

1, 2, 4, 7, 12, 23, 36, 53, 72, 95, 124, 155, 192, 233, 276, 323, 376, 435, 496, 563, 634, 707, 786, 869, 958, 1055, 1156, 1259, 1366, 1475, 1588, 1715, 1846, 1983, 2122, 2271, 2422, 2579, 2742, 2909, 3082, 3261, 3442, 3633, 3826, 4023, 4222, 4433, 4656, 4883
Offset: 1

Views

Author

Naohiro Nomoto, May 02 2003

Keywords

Comments

Surprisingly, except for the initial term, the first differences of this sequence is the sequence of primes with 7 omitted. - John W. Layman, Feb 25 2012
Also number of k that can be expressed as a signed sum of the first n-1 primes. - Seiichi Manyama, Oct 01 2019

Examples

			For n=4; 7 is the 4th prime. 7 = 7, 9 = 2+7, 10 = 3+7, 12 = 5+7 = 2+3+7, 14 = 2+5+7, 15 = 3+5+7, 17 = 2+3+5+7. Values of m are 7 and 9,10,12,14,15,17. so a(4)=7.
From _Seiichi Manyama_, Oct 01 2019: (Start)
7       =  7, so 7*2         = 14 = 24-10 = 24+(-2-3-5).
2+7     =  9, so (2+7)*2     = 18 = 24- 6 = 24+( 2-3-5).
3+7     = 10, so (3+7)*2     = 20 = 24- 4 = 24+(-2+3-5).
5+7     = 12, so (5+7)*2     = 24 = 24+ 0 = 24+(-2-3+5).
2+5+7   = 14, so (2+5+7)*2   = 28 = 24+ 4 = 24+( 2-3+5).
3+5+7   = 15, so (3+5+7)*2   = 30 = 24+ 6 = 24+(-2+3+5).
2+3+5+7 = 17. so (2+3+5+7)*2 = 34 = 24+10 = 24+( 2+3+5). (End)
From _Seiichi Manyama_, Oct 02 2019: (Start)
Let b(n) be the number of k (>=0) that can be expressed as the sum of distinct primes with largest prime in the sum not greater than prime(n).
n |b(n)|            |
--+----+------------+--------------------------------------
4 | 12 |  0         | 11
  |    |  2         | 13 =  2+11
  |    |  3         | 14 =  3+11
  |    |  5         | 16 =  5+11
  |    |  7         | 18 =  7+11
  |    |  8 = 3+5   | 19 =  8+11 = (3+5)+11
  |    |  9 = 17-8  | 20 =  9+11 = (2+3+5+7)-(3+5)+11
  |    | 10 = 17-7  | 21 = 10+11 = (2+3+5+7)-7    +11
  |    | 12 = 17-5  | 23 = 12+11 = (2+3+5+7)-5    +11
  |    | 14 = 17-3  | 25 = 14+11 = (2+3+5+7)-3    +11
  |    | 15 = 17-2  | 26 = 15+11 = (2+3+5+7)-2    +11
  |    | 17 = 17-0  | 28 = 17+11 = (2+3+5+7)      +11
--+----+------------+--------------------------------------
5 | 23 |  0         | 13
  |    |  2         | 15 =  2+13
  |    |  3         | 16 =  3+13
  |    |  5         | 18 =  5+13
  |    |  7         | 20 =  7+13
  |    |  8 = 3+5   | 21 =  8+13 = (3+5)  +13
  |    |  9 = 2+7   | 22 =  9+13 = (2+7)  +13
  |    | 10 = 2+3+5 | 23 = 10+13 = (2+3+5)+13
  |    | 11         | 24 = 11+13
  |    | ...        | ...
  |    | 17 = 28-11 | 30 = 17+13 = (2+3+5+7+11)-11     +13
  |    | 18 = 28-10 | 31 = 18+13 = (2+3+5+7+11)-(2+3+5)+13
  |    | 19 = 28- 9 | 32 = 19+13 = (2+3+5+7+11)-(2+7)  +13
  |    | 20 = 28- 8 | 33 = 20+13 = (2+3+5+7+11)-(3+5)  +13
  |    | 21 = 28- 7 | 34 = 21+13 = (2+3+5+7+11)- 7     +13
  |    | 23 = 28- 5 | 36 = 23+13 = (2+3+5+7+11)- 5     +13
  |    | 25 = 28- 3 | 38 = 25+13 = (2+3+5+7+11)- 3     +13
  |    | 26 = 28- 2 | 39 = 26+13 = (2+3+5+7+11)- 2     +13
  |    | 28 = 28- 0 | 41 = 28+13 = (2+3+5+7+11)        +13
--+----+------------+-------------------------------------
...
b(n) = Sum_{k=1..n} prime(k) + 1 - 3*2 = A007504(n) - 5 for n>3.
So a(n) = b(n-1) = A007504(n-1) - 5 for n>4. (End)
		

Crossrefs

Programs

  • PARI
    limit = 70; M = sum(i = 1, limit, prime(i)); v = vector(M); primeSum = 0; forprime (n = 1, prime(limit), count = 1; forstep (i = primeSum, 1, -1, if (v[i], count = count + 1; v[i + n] = 1)); v[n] = 1; print(count); primeSum = primeSum + n)

Formula

a(n) = A007504(n-1) - 5 for n > 4. - Seiichi Manyama, Oct 02 2019

Extensions

More terms from David Wasserman, Sep 16 2004

A140358 Smallest nonnegative integer k such that n = +-1+-2+-...+-k for some choice of +'s and -'s.

Original entry on oeis.org

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

Views

Author

John W. Layman, Jun 23 2008

Keywords

Examples

			From _Seiichi Manyama_, Aug 18 2020: (Start)
Illustration of initial terms:
   0 =  0 (empty sum).
   1 =  1.
   2 =  1 - 2 + 3.
   3 =  1 + 2.
   4 = -1 + 2 + 3.
   5 =  1 + 2 + 3 + 4 - 5.
   6 =  1 + 2 + 3.
   7 =  1 + 2 + 3 - 4 + 5.
   8 = -1 + 2 + 3 + 4.
   9 =  1 + 2 - 3 + 4 + 5.
  10 =  1 + 2 + 3 + 4.
... (End)
		

Crossrefs

Programs

  • Maple
    b:= proc(n,i) option remember;
          (n=0 and i=0) or n<=i*(i+1)/2 and (b(abs(n-i), i-1) or b(n+i, i-1))
        end:
    a:= proc(n) local k;
          for k from 0 while not b(n,k) do od; k
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Oct 19 2011
  • Mathematica
    b[n_, i_] := b[n, i] = (n==0 && i==0) || Abs[n] <= i(i+1)/2 && (b[n-i, i-1] || b[n+i, i-1]);
    a[n_] := Module[{k}, For[k = 0, !b[n, k], k++]; k];
    a /@ Range[0, 100] (* Jean-François Alcover, Nov 15 2020, after Alois P. Heinz *)

Formula

Conjecture when n is greater than 0. Choose k so that t(k)<=n
a(n) = a(-n) for all n in Z. - Seiichi Manyama, Aug 18 2020
Let k be the least integer such that t(k) >= n. If t(k) and n have the same parity then a(n) = k. Otherwise a(n) is equal to the least odd integer greater than k. - Rishi Advani, Jan 24 2021

Extensions

a(0)=3 prepended by Seiichi Manyama, Aug 17 2020
Edited and a(0)=0 from Alois P. Heinz, Aug 18 2020

A359199 Least prime p such that 2n can be written as a signed sum of p and the next 3 primes, or -1 if no such prime exists.

Original entry on oeis.org

5, 3, 3, 3, 7, 3, 3, 5, 3, 19, 3, 5, 79, 3, 113, 17, 467, 7, 5, 11, 19, 17, 19, 13, 7, 17, 1123, 17, 19, 23, 11, 23, 19, 31, 2153, 31, 13, 23, 29, 31, 29, 37, 43, 37, 17, 31, 19081, 37, 43, 41, 19319, 19, 37897, 53, 43, 54193, 35671, 47, 43, 53, 23, 53, 59, 47, 35603, 61
Offset: 0

Author

Karl-Heinz Hofmann and Peter Munn, Jun 04 2023

Keywords

Comments

We require each of the 4 primes to appear in the sum exactly once.
Inspired by the study of problems about the signed sum of consecutive primes, for example, by Rivera in 2000 (see link).
The equivalent sequence with 2 rather than 4 primes is A363544, which is closely related to A000230, which concerns prime gaps.
Conjecture: a satisfactory prime p exists for all n.
The magnitude of the terms exhibits a notable variation that depends on the number of negations in the sum. See the visualization in the links.
All odd primes appear in the sequence. When 2n = A034963(k) we see the last occurrence of the k-th prime. Obviously, these last occurrences correspond to the sums where all the signs are positive. Do any odd primes occur only once?

Examples

			The signed sums of 2, 3, 5 and 7 are all odd, so cannot be 2n for any n. So all terms are >= 3, the 2nd prime.
The 16 possible signed sums of 3, 5, 7 and 11 give 8 nonnegative totals: 2, 4, 6, 10, 12, 16, 20, 26. So a(1) = a(2) = a(3) = a(5) = a(6) = a(8) = a(10) = a(13) = 3.
0 was not one of the 8 totals, and 0 = 5 - 7 - 11 + 13. So a(0) = 5.
		

Programs

  • Python
    from sympy import nextprime
    import numpy as np
    aupto = 100
    A359199 = np.zeros(aupto+1, dtype=object)
    signset = np.array([[ 1,  1,  1,  1] , # green line in visualizations (see links)
                        [ 1,  1,  1, -1] , # red ribbon
                        [ 1,  1, -1,  1] , # red ribbon
                        [ 1, -1,  1,  1] , # red ribbon
                        [ 1,  1, -1, -1] , # magenta ribbon
                        [ 1, -1,  1, -1] , # magenta ribbon
                        [ 1, -1, -1,  1] , # magenta ribbon
                        [ 1, -1, -1, -1]], # red ribbon
                        dtype="i4")
    primeset = np.array([3, 5, 7, 11], dtype=object)
    while all(A359199) == 0:
        for signs in signset:
            asum = abs(sum(signs * primeset)) // 2
            if asum <= aupto and A359199[asum] == 0: A359199[asum] = primeset[0]
        primeset = np.append(primeset, nextprime(primeset[-1]))[1:]
    print(list(A359199))

Formula

For k >= 2, a(A034963(k)/2) = A000040(k).

A363544 Least prime p such that 2n can be written as the sum or absolute difference of p and the next prime, or -1 if no such prime exists.

Original entry on oeis.org

-1, 3, 7, 23, 3, 139, 5, 113, 1831, 7, 887, 1129, 11, 2477, 2971, 13, 5591, 1327, 17, 30593, 19333, 19, 15683, 81463, 28229, 31907, 23, 35617, 82073, 44293, 29, 34061, 89689, 162143, 31, 173359, 31397, 404597, 212701, 37, 542603, 265621, 41, 155921, 544279, 43, 927869, 1100977
Offset: 0

Author

Karl-Heinz Hofmann and Peter Munn, Jun 09 2023

Keywords

Comments

In recent years, a number of problems have been investigated that concern representing integers as the signed sum of consecutive prime numbers. See, for example, A327467 and the Rivera link.
A000230, which concerns prime gaps, can be considered a more historic such sequence. Here we look at a minor generalization of A000230 in the spirit of signed sums.
When a(n) <> -1, a(n) together with the next prime generate a satisfactory example for proving A362465(2n) = 2.

Programs

  • Python
    from sympy import sieve as prime
    def A363544(n):
        if n == 0: return -1
        k = 2
        while (prime[k] + prime[k+1]) < 2*n and (prime[k] + prime[k+1]) // 2 != n: k += 1
        if (prime[k] + prime[k+1]) // 2 == n: return prime[k]
        k = 2
        while (prime[k+1] - prime[k]) // 2 != n: k += 1
        return prime[k]
    print([A363544(n) for n in range(0,50)])

Formula

If 2n is in A001043 then a(n) = prime(k), where k is the position of 2n in A001043, otherwise for n > 0, a(n) = A000230(n).
a(n) = -1 if and only if A362465(2n) <> 2.
Showing 1-4 of 4 results.