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.

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