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

A173702 Partial sums of prime numbers of measurement A002049.

Original entry on oeis.org

1, 4, 11, 23, 43, 73, 117, 176, 251, 347, 465, 608, 777, 974, 1204, 1468, 1767, 2102, 2475, 2888, 3343, 3844, 4393, 4991, 5639, 6340, 7098, 7916, 8796, 9740, 10749, 11828, 12984, 14220, 15537, 16937
Offset: 1

Views

Author

Jonathan Vos Post, Nov 25 2010

Keywords

Comments

Prime partial sums of prime numbers of measurement begin: 11, 23, 43, 73, 251, 347, 3343, 5639, 16937. The subsequence of squares begins: 1, 4, 3844 = 2^2 * 31^2.

Examples

			a(10) =  1 + 3 + 7 + 12 + 20 + 30 + 44 + 59 + 75 + 96 = 347 is prime.
		

Crossrefs

Cf. A002049.

Programs

  • Python
    from itertools import count, accumulate, islice
    from collections import deque
    def A173702_gen(): # generator of terms
        aset, alist, a, b = set(), deque(), 0, 0
        for k in count(1):
            if k in aset:
                aset.remove(k)
            else:
                a += k
                yield (b:=a+b)
                aset |= set(k+d for d in accumulate(alist))
                alist.appendleft(k)
    A173702_list = list(islice(A173702_gen(),50)) # Chai Wah Wu, Sep 02 2025

Formula

a(n) = Sum_{i=1..n} A002049(i).

A185846 Primes in A002049.

Original entry on oeis.org

3, 7, 59, 197, 373, 701, 1009, 1571, 2749, 3581, 5701, 5881, 6247, 8269, 9397, 14369, 15881, 31019, 32707, 41801, 47269, 53633, 70177, 81931, 84701, 93239, 118369, 131213, 133873, 138373, 147661, 149561, 161159, 191929, 194069, 203857, 221813, 252823, 290161, 298201
Offset: 1

Views

Author

Jonathan Vos Post, Feb 06 2011

Keywords

Examples

			a(3) = A002049(8) = 59 = the 17th prime.
		

Crossrefs

Cf. A002049.

Programs

  • Python
    from itertools import count, accumulate, islice
    from collections import deque
    from sympy import isprime
    def A185846_gen(): # generator of terms
        aset, alist, c = set(), deque(), 0
        for k in count(1):
            if k in aset:
                aset.remove(k)
            else:
                c += k
                if isprime(c): yield c
                aset |= set(k+d for d in accumulate(alist))
                alist.appendleft(k)
    A185846_list = list(islice(A185846_gen(),40)) # Chai Wah Wu, Sep 01 2025

Extensions

More terms from Nathaniel Johnston, Feb 09 2011

A002048 Segmented numbers, or prime numbers of measurement.

Original entry on oeis.org

1, 2, 4, 5, 8, 10, 14, 15, 16, 21, 22, 25, 26, 28, 33, 34, 35, 36, 38, 40, 42, 46, 48, 49, 50, 53, 57, 60, 62, 64, 65, 70, 77, 80, 81, 83, 85, 86, 90, 91, 92, 100, 104, 107, 108, 116, 119, 124, 127, 132, 133, 137, 141, 144, 145, 148, 150, 151, 154, 158, 159, 163, 165
Offset: 1

Views

Author

Keywords

Comments

The segmented numbers are the positive integers excluding those equal to the sum of two or more consecutive smaller terms. The prime numbers of measurement are their partial sums, cf. A002049. - M. F. Hasler, Jun 26 2019
Without the requirement that the smaller terms be consecutive, the sequence becomes the sequence of powers of 2 (A000079). - Alonso del Arte, Jan 25 2020

Examples

			Although 5 is the sum of the terms 1 and 4, those prior terms are not consecutive, and therefore 5 is in the sequence.
6 is not in the sequence because it is the sum of consecutive prior terms 2 and 4.
7 is not in the sequence either because it is also the sum of consecutive prior terms, in this case 1, 2, 4.
8 is in the sequence because no sum whatsoever of distinct prior terms adds up to 8.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, E30.
  • Š. Porubský, On MacMahon's segmented numbers and related sequences. Nieuw Arch. Wisk. (3) 25 (1977), no. 3, 403--408. MR0485763 (58 #5575)
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A002049 (partial sums), A004978, A005242, A033627.

Programs

  • C
    // See Links section for C program by Samuel B. Reid, Jan 26 2020
    
  • Haskell
    import Data.List ((\\))
    a002048 n = a002048_list !! (n-1)
    a002048_list = f [1..] [] where
       f (x:xs) ys = x : f (xs \\ scanl (+) x ys) (x : ys)
    -- Reinhard Zumkeller, May 23 2013
    
  • Maple
    A002048 := proc(anmax::integer,printlist::boolean)
    local a, asum,su,i,piv,j;
    a := [];
    for i from 1 to anmax do
    a := [op(a),i];
    od:
    if printlist then
    printf("%d %d\n",1,a[1]);
    printf("%d %d\n",2,a[2]);
    fi;
    asum := [a[1]+a[2],a[2]];
    for i from 3 to anmax do
    asum := [op(asum),0];
    od:
    piv := 3;
    while piv <= nops(a) do
    for i from 1 to piv-2 do
    a := remove(has,a, asum[i]);
    od:
    if printlist then
    printf("%a %a\n",piv,a[piv]);
    fi;
    for i from 1 to piv do
    asum := subsop(i=asum[i]+a[piv], asum);
    od:
    piv := piv+1;
    od;
    RETURN(a);
    end:
    A002048(40000,true);
    # R. J. Mathar, Jun 04 2006
  • Mathematica
    A002048[anmax_] := (a = {}; Do[AppendTo[a, i], {i, anmax}]; asum = {a[[1]] + a[[2]], a[[2]]}; Do[AppendTo[asum, 0], {i, 3, anmax}]; piv = 3; While[piv <= Length[a], Do[a = DeleteCases[a, asum[[i]]], {i, 1, piv - 2}]; Do[asum[[i]] += a[[piv]], {i, piv}]; piv = piv + 1;]; a); A002048[63] (* Jean-François Alcover, Jul 28 2011, converted from R. J. Mathar's Maple prog. *)
    searchMax = 200; segmNums = {1}; curr = 2; While[curr < searchMax, If[Not[MemberQ[Apply[Plus, Subsequences[segmNums], 1], curr]], AppendTo[segmNums, curr], ];  curr = curr + 1]; segmNums (* Alonso del Arte, Jan 25 2020 *)
  • Python
    from itertools import count, accumulate, islice
    from collections import deque
    def A002048_gen(): # generator of terms
        aset, alist = set(), deque()
        for k in count(1):
            if k in aset:
                aset.remove(k)
            else:
                yield k
                aset |= set(k+d for d in accumulate(alist))
                alist.appendleft(k)
    A002048_list = list(islice(A002048_gen(),20)) # Chai Wah Wu, Sep 01 2025

Formula

Andrews conjectures that lim_{n -> oo} n log n / (a(n) loglog n) = 1. - N. J. A. Sloane, Dec 01 2013

Extensions

More terms from R. J. Mathar, May 31 2006

A004978 a(n) = least integer m > a(n-1) such that m - a(n-1) != a(j) - a(k) for all j, k less than n; a(1) = 1, a(2) = 2.

Original entry on oeis.org

1, 2, 4, 8, 13, 21, 31, 45, 60, 76, 97, 119, 144, 170, 198, 231, 265, 300, 336, 374, 414, 456, 502, 550, 599, 649, 702, 759, 819, 881, 945, 1010, 1080, 1157, 1237, 1318, 1401, 1486, 1572, 1662, 1753, 1845, 1945, 2049, 2156, 2264, 2380, 2499, 2623, 2750, 2882
Offset: 1

Views

Author

N. J. A. Sloane. This was in the 1973 "Handbook", but was then dropped from the database. Resubmitted by Clark Kimberling. Entry revised by N. J. A. Sloane, Jun 10 2012

Keywords

Comments

Equivalently, if S(n) = { a(j) - a(k); n > j > k > 0 }, then a(n) = a(n-1) + M where M = min( {1, 2, 3, ...} \ S(n) ) is the smallest positive integer not in S(n). - M. F. Hasler, Jun 26 2019

Examples

			From _M. F. Hasler_, Jun 26 2019: (Start)
After a(1) = 1, a(2) = 2, we have a(3) = least m > a(2) such that m - a(2) = m - 2 is not in { a(j) - a(k); 1 <= k < j < 3 } = { a(2) - a(1) } = { 1 }. Thus we must have m - 2 = 2, whence m = 4.
The next term a(4) is the least m > a(3) such that m - a(3) = m - 4 is not in { a(j) - a(k); 1 <= k < j < 4 } = { 1, 4 - 2 = 2, 4 - 1 = 3 }, i.e., m = 4 + 4 = 8.
The next term a(5) is the least m > a(4) such that m - a(4) = m - 8 is not in { a(j) - a(k); 1 <= k < j < 5 } = { 1, 2, 3, 8 - 4 = 4, 8 - 2 = 6, 8 - 1 = 7 }, i.e., m = 5 + 8 = 13. (End)
		

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

Crossrefs

Differences give A002048, see also A048201.
See also A001856.
For n>2, a(n) equals A002049(n-1)+1 and A048204(n-2)+2.

Programs

  • MATLAB
    s=1:2000^2;d(1)=1;A004978(1)=1;A004978(2)=2;
    for n=3:2000
      A004978(n)=A004978(n-1)+find([d,0]~=s(1:max(size(d))+1),1);
      d(end+1:end+n-1)=A004978(n)-A004978(1:n-1);
      d=sort(unique(d));
    end
    % Nathaniel Johnston, Feb 09 2011
    
  • PARI
    A004978_vec(N,a=[1..N],S=[1])={for(n=3,N,a[n]=a[n-1]+S[1]+1;S=setunion(S,select(t->t>S[1],vector(n-1,k,a[n]-a[n-k])));for(k=1,#S-1, if(S[k+1]-S[k]>1, S=S[k..-1];next(2)));S[#S]==#S&&S=[#S]);a} \\ M. F. Hasler, Jun 26 2019
    
  • Python
    from itertools import count, accumulate, islice
    from collections import deque
    def A004978_gen(): # generator of terms
        aset, alist, c = set(), deque(), 1
        for k in count(1):
            if k in aset:
                aset.remove(k)
            else:
                yield c
                aset |= set(k+d for d in accumulate(alist))
                alist.appendleft(k)
                c += k
    A004978_list = list(islice(A004978_gen(),20)) # Chai Wah Wu, Sep 01 2025

Extensions

Definition corrected by Bryan S. Robinson, Mar 16 2006
Name edited by M. F. Hasler, Jun 26 2019

A048201 Triangular array T read by rows: T(i,j)=b(i+1)-b(i+1-j); j=1,2,...,i; i=1,2,3,...; b=A004978.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 5, 9, 11, 12, 8, 13, 17, 19, 20, 10, 18, 23, 27, 29, 30, 14, 24, 32, 37, 41, 43, 44, 15, 29, 39, 47, 52, 56, 58, 59, 16, 31, 45, 55, 63, 68, 72, 74, 75, 21, 37, 52, 66, 76, 84, 89, 93, 95, 96, 22, 43, 59, 74, 88, 98, 106, 111
Offset: 1

Views

Author

Keywords

Examples

			Rows: {1}, {2,3},{4,6,7}, ...
		

Crossrefs

T(n, 1)=c(n), where c=A002048.
T(n, n)=d(n), where d=A002049.

Formula

T(n, 1)=least number not in any preceding row and T(n, k)=T(n, 1)+T(n-1, 1)+...+T(n-k+1, 1) for k >= 2.

A362040 a(n) is the number of distinct sums of one or more contiguous terms in the sequence thus far.

Original entry on oeis.org

0, 1, 2, 4, 7, 10, 15, 21, 26, 34, 42, 52, 63, 75, 86, 96, 109, 125, 142, 160, 179, 197, 216, 238, 259, 281, 306, 332, 359, 387, 416, 442, 473, 505, 536, 567, 600, 636, 669, 707, 746, 784, 823, 865, 906, 948, 992, 1036, 1083, 1129, 1172, 1222, 1269, 1321, 1374, 1428
Offset: 1

Views

Author

Neal Gersh Tolunsky, Apr 15 2023

Keywords

Examples

			At n=1, there are no contiguous subsequences, so a(1)=0.
At n=2, there is one contiguous subsequence: [0], so a(2)=1.
At n=3, there are three contiguous subsequences: [0], [1] and [0, 1], but only two distinct sums (0 and 1), so a(3)=2.
		

Crossrefs

Cf. A361798 (number of sums).

Programs

  • Python
    from itertools import islice
    def gen_a():
        seen = set()
        sums = []
        new = 0
        while True:
            for v in sums: seen.add(v + new)
            sums = [v + new for v in sums]
            sums.append(0)
            new = len(seen)
            yield new
    print(list(islice(gen_a(), 60))) # Winston de Greef, Apr 15 2023

Formula

a(n) <= A000217(n).

Extensions

a(13)-a(15) corrected and more terms from Winston de Greef, Apr 15 2023
Showing 1-6 of 6 results.