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.

Previous Showing 21-30 of 116 results. Next

A348413 a(0) = A002858(1) = 1, followed by the greatest Ulam numbers A002858 to form a complete sequence (see algorithm below).

Original entry on oeis.org

1, 2, 4, 8, 16, 28, 57, 114, 221, 451, 893, 1792, 3549, 7104, 14212, 28445, 56894, 113792, 227554, 455124, 910208, 1820449, 3640907, 7281813, 14563613, 29127251, 58254501, 116508984, 233017889, 466035877, 932071736
Offset: 0

Views

Author

Frank M Jackson, Oct 17 2021

Keywords

Comments

This sequence starts at a(0)=1, subsequent terms a(n) for n>0 being obtained by selecting the (greatest Ulam number) <= 1+Sum_{i=0..n-1} a(i). This ensures that the sequence is complete because Sum_{i=0..n-1} a(i) >= a(n)-1, for all n>=0 and a(0)=1, is a necessary and sufficient condition for completeness.

Examples

			Given that the first 7 terms of the sequence are 1, 2, ..., 28, 57 then a(7)=(greatest Ulam number) <= (1+2+...+28, 57) + 1 = 117, hence a(7)=114.
		

Crossrefs

Cf. A002858.

Programs

  • Mathematica
    lst1 = Last/@ReadList["https://oeis.org/A002858/b002858.txt", {Number, Number}]; lst={1, 2}; n=3; Do[s=Total@lst; While[s+1>=lst1[[n]], n++]; AppendTo[lst, lst1[[n-1]]], 16]; lst

Formula

a(n) = (greatest Ulam number) <= 1+Sum_{i=0..n-1} a(i), with a(0) = 1.

Extensions

a(18)-a(30) from Amiram Eldar, Oct 17 2021

A005282 Mian-Chowla sequence (a B_2 sequence): a(1) = 1; for n>1, a(n) = smallest number > a(n-1) such that the pairwise sums of elements are all distinct.

Original entry on oeis.org

1, 2, 4, 8, 13, 21, 31, 45, 66, 81, 97, 123, 148, 182, 204, 252, 290, 361, 401, 475, 565, 593, 662, 775, 822, 916, 970, 1016, 1159, 1312, 1395, 1523, 1572, 1821, 1896, 2029, 2254, 2379, 2510, 2780, 2925, 3155, 3354, 3591, 3797, 3998, 4297, 4433, 4779, 4851
Offset: 1

Views

Author

Keywords

Comments

An alternative definition is to start with 1 and then continue with the least number such that all pairwise differences of distinct elements are all distinct. - Jens Voß, Feb 04 2003. [However, compare A003022 and A227590. - N. J. A. Sloane, Apr 08 2016]
Rachel Lewis points out [see link] that S, the sum of the reciprocals of this sequence, satisfies 2.158435 <= S <= 2.158677. Similarly, the sum of the squares of reciprocals of this sequence converges to approximately 1.33853369 and the sum of the cube of reciprocals of this sequence converges to approximately 1.14319352. - Jonathan Vos Post, Nov 21 2004; comment changed by N. J. A. Sloane, Jan 02 2020
Let S denote the reciprocal sum of a(n). Then 2.158452685 <= S <= 2.158532684. - Raffaele Salvia, Jul 19 2014
From Thomas Ordowski, Sep 19 2014: (Start)
Known estimate: n^2/2 + O(n) < a(n) < n^3/6 + O(n^2).
Conjecture: a(n) ~ n^3 / log(n)^2. (End)

Examples

			The second term is 2 because the 3 pairwise sums 1+1=2, 1+2=3, 2+2=4 are all distinct.
The third term cannot be 3 because 1+3 = 2+2. But it can be 4, since 1+4=5, 2+4=6, 4+4=8 are distinct and distinct from the earlier sums 1+1=2, 1+2=3, 2+2=4.
		

References

  • P. Erdős and R. Graham, Old and new problems and results in combinatorial number theory. Monographies de L'Enseignement Mathématique (1980).
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.20.2.
  • R. K. Guy, Unsolved Problems in Number Theory, E28.
  • A. M. Mian and S. D. Chowla, On the B_2-sequences of Sidon, Proc. Nat. Acad. Sci. India, A14 (1944), 3-4.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Row 2 of A347570.
Cf. A051788, A080200 (for differences between terms).
Different from A046185. Cf. A011185.
See also A003022, A227590.
A259964 has a greater sum of reciprocals.
Cf. A002858.

Programs

  • Haskell
    import Data.Set (Set, empty, insert, member)
    a005282 n = a005282_list !! (n-1)
    a005282_list = sMianChowla [] 1 empty where
       sMianChowla :: [Integer] -> Integer -> Set Integer -> [Integer]
       sMianChowla sums z s | s' == empty = sMianChowla sums (z+1) s
                            | otherwise   = z : sMianChowla (z:sums) (z+1) s
          where s' = try (z:sums) s
                try :: [Integer] -> Set Integer -> Set Integer
                try []     s                      = s
                try (x:sums) s | (z+x) `member` s = empty
                               | otherwise        = try sums $ insert (z+x) s
    -- Reinhard Zumkeller, Mar 02 2011
    
  • Maple
    a[1]:= 1: P:= {2}: A:= {1}:
    for n from 2 to 100 do
      for t from a[n-1]+1 do
        Pt:= map(`+`,A union {t},t);
        if Pt intersect P = {} then break fi
      od:
      a[n]:= t;
      A:= A union {t};
      P:= P union Pt;
    od:
    seq(a[n],n=1..100); # Robert Israel, Sep 21 2014
  • Mathematica
    t = {1}; sms = {2}; k = 1; Do[k++; While[Intersection[sms, k + t] != {}, k++]; sms = Join[sms, t + k, {2 k}]; AppendTo[t, k], {49}]; t (* T. D. Noe, Mar 02 2011 *)
  • PARI
    A005282_vec(N, A=[1], U=[0], D(A, n=#A)=vector(n-1, k, A[n]-A[n-k]))={ while(#A2 && U=U[k-1..-1]);A} \\ M. F. Hasler, Oct 09 2019
    
  • PARI
    aupto(L)= my(S=vector(L), A=[1]); for(i=2, L, for(j=1, #A, if(S[i-A[j]], next(2))); for(j=1, #A, S[i-A[j]]=1); A=concat(A, i)); A \\ Ruud H.G. van Tol, Jun 30 2025
    
  • Python
    from itertools import count, islice
    def A005282_gen(): # generator of terms
        aset1, aset2, alist = set(), set(), []
        for k in count(1):
            bset2 = {k<<1}
            if (k<<1) not in aset2:
                for d in aset1:
                    if (m:=d+k) in aset2:
                        break
                    bset2.add(m)
                else:
                    yield k
                    alist.append(k)
                    aset1.add(k)
                    aset2 |= bset2
    A005282_list = list(islice(A005282_gen(),30)) # Chai Wah Wu, Sep 05 2023

Formula

a(n) = A025582(n) + 1.
a(n) = (A034757(n)+1)/2.

Extensions

Examples added by N. J. A. Sloane, Jun 01 2008

A033627 0-additive sequence: not the sum of any previous pair.

Original entry on oeis.org

1, 2, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175
Offset: 1

Views

Author

Keywords

Comments

Conjecture: a(n+1) is the number of distinct numbers of steps required for the last n digits of integers to repeat themselves by iterating the map m -> m^2 + 1. - Ya-Ping Lu, Oct 19 2021

References

  • R. K. Guy, Unsolved Problems in Number Theory, C4

Crossrefs

See A244151 for another version.

Programs

  • Haskell
    import Data.List ((\\))
    a033627 n = a033627_list !! (n-1)
    a033627_list = f [1..] [] where
       f (x:xs) ys = x : f (xs \\ (map (+ x) ys)) (x:ys)
    -- Reinhard Zumkeller, Jan 11 2012
    
  • Mathematica
    Join[{1,2},Range[4,200,3]] (* Vladimir Joseph Stephan Orlovsky, Jan 27 2012 *)
    f[s_List] := Block[{k = s[[-1]] + 1, ss = Union[ Plus @@@ Subsets[s, {2}]]}, While[ MemberQ[ ss, k], k++]; Append[ s, k]]; Nest[f, {1}, 70] (* Robert G. Wilson v, Jun 23 2014 *)
    CoefficientList[Series[x(1+x^2+x^3)/(1-x)^2 , {x, 0, 70}], x] (* Stefano Spezia, Oct 04 2018 *)
  • PARI
    a(n)=if(n>2,3*n-5,n) \\ Charles R Greathouse IV, Sep 01 2016
    
  • Python
    def a(n): return 3*n-5 if n > 2 else n
    print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Jun 09 2025

Formula

2 together with numbers of form 3k+1 (A016777).
From Gary W. Adamson, May 10 2008: (Start)
Equals binomial transform of [1, 1, 1, 0, -1, 2, -3, 4, -5, 6, -7, ...].
Equals sum of antidiagonal terms of the following arithmetic array: 1, 1, 1, 1, 1, ... 1, 2, 3, 4, 5, ... 1, 3, 5, 7, 9, ... . (End)
From Colin Barker, Sep 19 2012: (Start)
a(n) = 3*n - 5, for n > 2.
a(n) = 2*a(n-1) - a(n-2), for n > 4;
G.f.: x*(1+x^2+x^3)/(1-x)^2. (End)
E.g.f.: 5 + 3*x + x^2/2 + exp(x)*(3*x - 5). - Stefano Spezia, Apr 15 2023

A004280 2 together with the odd numbers (essentially the result of the first stage of the sieve of Eratosthenes).

Original entry on oeis.org

1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131
Offset: 1

Views

Author

Keywords

Comments

Number of Fibonacci binary words of length n and having no subword 1011. A Fibonacci binary word is a binary word having no 00 subword. Example: a(5) = 9 because of the 13 Fibonacci binary words of length 5 the following do not qualify: 11011, 10110, 10111 and 01011. - Emeric Deutsch, May 13 2007
a(1) = 1; for n > 1, a(n) = least number > a(n-1) which is a unique sum of two earlier terms, not necessarily distinct. - Franklin T. Adams-Watters, Nov 01 2011

References

  • F. S. Roberts, Applied Combinatorics, Prentice-Hall, 1984, p. 256.

Crossrefs

Cf. A002858.

Programs

Formula

From Paul Barry, Mar 05 2007: (Start)
G.f.: x*(1+x^3)/(1-x)^2;
a(n) = 2*n - 3 + C(1, n-1) + C(0, n-1). (End)
a(n) = 2*n - 3 + floor(2/n). - Wesley Ivan Hurt, May 23 2013
E.g.f.: (1/2)*(6 + 4*x + x^2 - 2*(3 - 2*x)*exp(x)). - G. C. Greubel, Nov 25 2021

Extensions

Offset changed to 1 and formulas updated accordingly (at the suggestion of Michel Marcus) by Charles R Greathouse IV, Sep 03 2013

A054540 A list of equal temperaments (equal divisions of the octave) whose nearest scale steps are closer and closer approximations to the six simple ratios of musical harmony: 6/5, 5/4, 4/3, 3/2, 8/5 and 5/3.

Original entry on oeis.org

1, 2, 3, 5, 7, 12, 19, 31, 34, 53, 118, 171, 289, 323, 441, 612, 730, 1171, 1783, 2513, 4296, 12276, 16572, 20868, 25164, 46032, 48545, 52841, 73709, 78005, 151714, 229719, 537443, 714321, 792326, 944040, 1022045, 1251764, 3755292, 3985011
Offset: 0

Views

Author

Mark William Rankin (MarkRankin95511(AT)Yahoo.com), Apr 09 2000; Dec 17 2000

Keywords

Comments

The sequence was found by a computer search of all of the equal divisions of the octave from 1 to over 3985011. There seems to be a hidden aspect or mystery here: what is it about the more and more harmonious equal temperaments that causes them to express themselves collectively as a perfect, self-accumulating recurrent sequence?
From Eliora Ben-Gurion, Dec 15 2022: (Start)
The answer is because temperament mappings can be added. If harmonic correspondences are written in a bra, that is
Example: a tuning with 118 equal steps to the octave has a second harmonic on the 118th step by definition, the third harmonic is approximated with 187 steps, and the fifth is with 274 steps, which leads to <118 187 274]. A 171 equal division system will have a corresponding bra <171 271 397]. When these two are added, we obtain <289 458 671], which is exactly how the 2nd, 3rd, and 5th harmonics are represented in 289 equal divisions of the octave. (End)

Examples

			34 = 31 + the earlier term 3. Again, 118 = 53 + the earlier terms 34 and 31.
		

Formula

Stochastic recurrence rule - the next term equals the current term plus one or more previous terms: a(n+1) = a(n) + a(n-x) + ... + a(n-y) + ... + a(n-z), etc.

A007300 a(1)=2, a(2)=5; for n >= 3, a(n) is smallest number which is uniquely of the form a(j) + a(k) with 1 <= j < k < n.

Original entry on oeis.org

2, 5, 7, 9, 11, 12, 13, 15, 19, 23, 27, 29, 35, 37, 41, 43, 45, 49, 51, 55, 61, 67, 69, 71, 79, 83, 85, 87, 89, 95, 99, 107, 109, 119, 131, 133, 135, 137, 139, 141, 145, 149, 153, 155, 161, 163, 167, 169, 171, 175, 177, 181, 187, 193, 195, 197, 205, 209, 211, 213, 215
Offset: 1

Keywords

Comments

An Ulam-type sequence - see A002858 for many further references, comments, etc.
I have a note saying that this is periodic mod 126. Is that correct? - N. J. A. Sloane, Apr 29 2006
Comments from Joshua Zucker, May 24 2006: "Concerning the conjecture about periodicity mod 126. Out of the first 300 terms, only the 2 and 12 are even. But if you neglect those first 6 terms, mod 2 they're all odd, mod 9 it goes: 0 4 6 1 7 4 6 8 7 2 4 6 8 5 0 8 1 2 5 7 0 2 4 6 1 5 0 2 8 1 5 7 which appears to repeat indefinitely and mod 7 it goes: 0 2 6 1 3 0 2 6 5 4 6 1 2 6 1 3 5 4 1 2 4 0 5 0 2 4 6 1 5 2 6 1 which also appears to repeat indefinitely.
"So it seems as though neglecting the first few terms, it is indeed periodic mod 126 with period 32. In fact it appears that after the first few terms, a(n+32) = a(n) + 126. But this is only based on the first few hundred terms and is not proved!
"The Mathworld link cites a proof that sequences of this type (2,n) have only two even terms and another proof that sequences with only finitely many even terms must eventually have periodic first differences. So I think the period 32 difference of 126 conjecture may be proved in those references."
Given that the sequence of first differences is periodic with period 32 after the first 6 terms (3,2,2,2,1,1), the repeating digits being p=(2,4,4,4,2,6,2,4,2,2,4,2,4,6,6,2,2,8,4,2,2,2,6,4,8,2,10,12,2,2,2,2), one can calculate the n-th term (n>6) as a(n)=13+floor((n-7)/32)*S(32)+S(n-7 mod 32) where S(k)=sum(p(i),i=1..k): (S(k);k=0..32)=(0, 2, 6, 10, 14, 16, 22, 24, 28, 30, 32, 36, 38, 42, 48, 54, 56, 58, 66, 70, 72, 74, 76, 82, 86, 94, 96, 106, 118, 120, 122, 124, 126). - M. F. Hasler, Nov 25 2007

References

  • R. K. Guy, Unsolved Problems in Number Theory, Section C4.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a007300 n = a007300_list !! (n-1)
    a007300_list = 2 : 5 : ulam 2 5 a007300_list
    -- Function ulam as defined in A002858.
    -- Reinhard Zumkeller, Nov 03 2011
  • Maple
    A007300:=n->if n<7 then [2, 5, 7, 9, 11, 12][n] else floor((n-7)/32)*126+[13, 15, 19, 23, 27, 29, 35, 37, 41, 43, 45, 49, 51, 55, 61, 67, 69, 71, 79, 83, 85, 87, 89, 95, 99, 107, 109, 119, 131, 133, 135, 137][modp(n-7,32)+1] fi; # M. F. Hasler, Nov 25 2007
  • Mathematica
    theList = {2,5}; Print[2]; Print[5]; For[i=1,i <= 500,i++, count=0; For[j=1,j <= Length[theList]-1,j++, For[k=j+1,k <= Length[theList],k++, If[theList[[j]]+theList[[k]] == i,count++ ]; ]; ]; If[count == 1, Print[i]; theList = Append[theList,i]; ]; ]; (* Sam Handler (sam_5_5_5_0(AT)yahoo.com), Aug 08 2006 *)
    Nest[Append[#, SelectFirst[Union@ Select[Tally@ Map[Total, Select[Permutations[#, {2}], #1 < #2 & @@ # &]], Last@ # == 1 &][[All, 1]], Function[k, FreeQ[#, k]]]] &, {2, 5}, 59] (* Michael De Vlieger, Nov 16 2017 *)

Formula

For n > 6, a(n+32) = a(n) + 126. - T. D. Noe, Jan 21 2008

Extensions

More terms from Joshua Zucker, May 24 2006
More terms from Sam Handler (sam_5_5_5_0(AT)yahoo.com), Aug 08 2006

A002859 a(1) = 1, a(2) = 3; for n >= 3, a(n) is smallest number that is uniquely of the form a(j) + a(k) with 1 <= j < k < n.

Original entry on oeis.org

1, 3, 4, 5, 6, 8, 10, 12, 17, 21, 23, 28, 32, 34, 39, 43, 48, 52, 54, 59, 63, 68, 72, 74, 79, 83, 98, 99, 101, 110, 114, 121, 125, 132, 136, 139, 143, 145, 152, 161, 165, 172, 176, 187, 192, 196, 201, 205, 212, 216, 223, 227, 232, 234, 236, 243, 247, 252, 256, 258
Offset: 1

Keywords

Comments

An Ulam-type sequence - see A002858 for many further references, comments, etc.

Examples

			7 is missing since 7 = 1 + 6 = 3 + 4; but 8 is present since 8 = 3 + 5 has a unique representation.
		

References

  • S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 145-151.
  • R. K. Guy, Unsolved Problems in Number Theory, Section C4.
  • R. K. Guy, "s-Additive sequences," preprint, 1994.
  • C. Pickover, Mazes for the Mind, St. Martin's Press, NY, 1992, p. 358.
  • 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).
  • S. M. Ulam, Problems in Modern Mathematics, Wiley, NY, 1960, p. ix.

Crossrefs

Cf. A002858 (version beginning 1,2), A199118, A199119.

Programs

  • Haskell
    a002859 n = a002859_list !! (n-1)
    a002859_list = 1 : 3 : ulam 2 3 a002859_list
    -- Function ulam as defined in A002858.
    -- Reinhard Zumkeller, Nov 03 2011
  • Mathematica
    s = {1, 3}; Do[ AppendTo[s, n = Last[s]; While[n++; Length[ DeleteCases[ Intersection[s, n-s], n/2, 1, 1]] != 2]; n], {60}]; s (* Jean-François Alcover, Oct 20 2011 *)

A007086 Next term is uniquely the sum of 3 earlier terms.

Original entry on oeis.org

1, 2, 3, 6, 9, 10, 11, 12, 28, 29, 30, 53, 56, 57, 80, 82, 104, 105, 107, 129, 130, 132, 154, 155, 157, 179, 180, 182, 204, 205, 207, 229, 230, 232, 254, 255, 257, 279, 280, 282, 304, 305, 307, 329, 330, 332, 354, 355, 357, 379, 380, 382, 404, 405, 407, 429
Offset: 1

Keywords

Comments

a(1)=1, a(2)=2, a(3)=3, for n>3, a(n) = least number which is a unique sum of three distinct earlier terms. Written this way, we see that this is to 3 as Ulam number A002858 is to 2. - Jonathan Vos Post

Examples

			13 through 27 are not in the sequence because of nonuniqueness: 1+3+9=1+2+10=13, 1+3+10=2+3+9=14, 1+2+12=2+3+10=15, 1+6+9=2+3+11=16, 1+7+9=2+6+9=17, 3+6+9=1+6+11=18, 1+6+12=2+6+11=19, 1+9+10=2+6+12=20, 1+9+11=2+9+10=21, 1+10+11=2+9+11=22, 2+9+12=3+9+11=23, 1+11+12=3+9+12=24, 3+10+12=6+9+10=25, 3+11+12=6+9+11=26, 6+9+12=6+10+11=27. - _Jonathan Vos Post_
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • M. C. Wunderlich, The improbable behavior of Ulam's summation sequence, pp. 249-257 of A. O. L. Atkin and B. J. Birch, editors, Computers in Number Theory. Academic Press, NY, 1971.

Crossrefs

Cf. A002858.

Programs

  • Mathematica
    Clear[a]; a[n_ /; n <= 3] := n; a[n_] := a[n] = (t = Table[a[i]+a[j]+a[k], {i, 1, n-3}, {j, i+1, n-2}, {k, j+1, n-1}] // Flatten; Complement[Select[t // Tally, #[[2]] == 1&][[All, 1]], Array[a, n-1]] // Sort // First); Array[a, 56] (* Jean-François Alcover, Mar 11 2014 *)

Formula

G.f.: (22*x^18 -21*x^17 +x^16 -2*x^13 -7*x^12 -15*x^9 +2*x^8 +2*x^7 -2*x^5 -2*x^4 -x^3 -x^2 -x) / (-x^4+x^3+x-1). Conjectured and verified for n<=1100 - Alois P. Heinz, Jan 04 2011

A183534 Square array of generalized Ulam numbers U(n,k), n>=1, k>=2, read by antidiagonals: U(n,k) = n if n<=k; for n>k, U(n,k) = least number > U(n-1,k) which is a unique sum of k distinct terms U(i,k) with i

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 6, 6, 1, 2, 3, 4, 9, 8, 1, 2, 3, 4, 10, 10, 11, 1, 2, 3, 4, 5, 16, 11, 13, 1, 2, 3, 4, 5, 15, 17, 12, 16, 1, 2, 3, 4, 5, 6, 25, 18, 28, 18, 1, 2, 3, 4, 5, 6, 21, 26, 19, 29, 26, 1, 2, 3, 4, 5, 6, 7, 36, 27, 22, 30, 28, 1, 2, 3, 4, 5, 6, 7, 28, 37, 28, 64, 53, 36
Offset: 1

Author

Keywords

Comments

The columns are Ulam-type sequences - see A002858 for further information. Some of these sequences - but not all - seem to have quite simple generating functions.
U(k+1,k) = k*(k+1)/2.
U(k+2+j,k) = k^2+j for k>=3 and 0<=j
U(2*k+2,k) = k*(3*k-1)/2 for k>=3.

Examples

			Square array U(n,k) begins:
  1,  1,  1,  1,  1,  1,  ...
  2,  2,  2,  2,  2,  2,  ...
  3,  3,  3,  3,  3,  3,  ...
  4,  6,  4,  4,  4,  4,  ...
  6,  9, 10,  5,  5,  5,  ...
  8, 10, 16, 15,  6,  6,  ...
		

Crossrefs

Programs

  • Maple
    b:= proc(n,i,k,h) option remember;
          local t;
          if n<0 or h<0 then 0
        elif n=0 then `if`(h=0, 1, 0)
        elif i=0 or h=0 then 0
        elif h=1 then t:= v(n, k);
                      `if`(t>0 and t<=i, 1, 0)
                 else t:= b(n -U(i, k), i-1, k, h-1);
                      t+ `if`(t>1, 0, b(n, i-1, k, h))
          fi
        end:
    v:= proc() 0 end:
    U:= proc(n,k) option remember;
          local m;
          if n<=k then v(n,k):= n
                  else for m from U(n-1, k)+1
                         while b(m, n-1, k, k)<>1 do od;
                       v(m,k):= n; m
          fi
        end:
    seq(seq(U(n, 2+d-n), n=1..d), d=1..12);
  • Mathematica
    b[n_, i_, k_, h_] := b[n, i, k, h] = Module[{t}, Which[n < 0 || h < 0, 0, n == 0, If[h == 0, 1, 0], i == 0 || h == 0, 0, h == 1, t = v[n, k]; If[t > 0 && t <= i, 1, 0], True, t = b[n-U[i, k], i-1, k, h-1]; t+If[t > 1, 0, b[n, i-1, k, h]] ] ]; v[, ] = 0; U[n_, k_] := U[n, k] = Module[{m}, If[n <= k, v[n, k] = n, For[m = U[n-1, k]+1, b[m, n-1, k, k] != 1, m++]; v[m, k] = n; m] ]; Table[Table[U[n, 2+d-n], {n, 1, d}], {d, 1, 12}] // Flatten (* Jean-François Alcover, Dec 23 2013, translated from Maple *)
  • PARI
    Ulam(N,k=2,v=0)={ my( a=vector(k,i,i), c );
    for( n=k,N-1, for( t=1+a[n],9e9, c=0;
      forvec(v=vector(k,i,[i,n]),sum(j=1,k,a[v[j]])==t & c++>1 & next(2),2);
      c||next; v&print1(t","); a=concat(a,t); break;
    )); a}
    /* M. F. Hasler */

A135737 Ulam type (1-additive) sequences u[1]=2, u[2]=2n+1, u[k+1] is least unique sum u[i]+u[j]>u[k], 1<=i

Original entry on oeis.org

2, 3, 2, 5, 5, 2, 7, 7, 7, 2, 8, 9, 9, 9, 2, 9, 11, 11, 11, 11, 2, 13, 12, 13, 13, 13, 13, 2, 14, 13, 15, 15, 15, 15, 15, 2, 18, 15, 16, 17, 17, 17, 17, 17, 2, 19, 19, 17, 19, 19, 19, 19, 19, 19, 2, 24, 23, 19, 20, 21, 21, 21, 21, 21, 21, 2, 25, 27, 21, 21, 23, 23, 23, 23, 23, 23, 23
Offset: 1

Author

M. F. Hasler, Nov 26 2007

Keywords

Comments

Any of the sequences u=U(2,2n+1) has u[1]=2 and u[n+4]=4n+4; in between these there are the odd numbers 2n+1,...,4n-3. For n>1 there are no other even terms and the sequence of first differences becomes periodic for k>=t (transient phase), such that u[k] = u[k-floor((k-t)/p)*p] + floor((k-t)/p)*d, where p is the period (cf. A100729) and d the fundamental difference (cf. A100730). See the cross-references, especially A002858, for more information.

Examples

			The sequence contains the terms of the table T[n,k] = U(2,2n+1)[k], read by antidiagonals: a[1]=T[1,1]=2, a[2]=T[1,2]=3, a[3]=T[2,1]=2, a[4]=T[1,3]=5,...
n=1: U(2,3)= 2, 3, 5, 7, 8, 9,13,14...
n=2: U(2,5)= 2, 5, 7, 9,11,12,...
n=3: U(2,7)= 2, 7, 9,11,13,...
n=4: U(2,9)= 2, 9,11,...
		

Crossrefs

Cf. A001857 = U(2, 3) = row 1, A007300 = U(2, 5) = row 2, A003668 = U(2, 7) = row 3; A100729-A100730 (period).
Cf. A002858 = U(1, 2): this would be row 0, with u[1], u[2] exchanged.
See also: A002859 = U(1, 3), A003666 = U(1, 4), A003667 = U(1, 5).

Programs

  • PARI
    ulam(a,b,Nmax=30,i)=a=[a,b]; b=[a[1]+b]; for( k=3,Nmax, i=1; while(( i<#b && b[i]==b[i+1] && i+=2 ) || ( i>1 && b[i]==b[i-1] && i++),); a=concat(a,b[i]); b=vecsort(concat(vecextract(b,Str("^..",i)),vector(k-1,j,a[k]+a[j]))); i=0; for(j=1,#b-2, if( b[j]==b[j+2], i+=1<A135737(Nmax=100)=local(T=vector(sqrtint(Nmax*2)+1,n, ulam(2,2*n+1, sqrtint(Nmax*2)+2-n)),i,j); vector(Nmax,k,if(j>1,T[i++ ][j-- ],j=i+1;T[i=1][j]))
Previous Showing 21-30 of 116 results. Next