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

A199118 Number of partitions of n into terms of (1,3)-Ulam sequence, cf. A002859.

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 6, 7, 10, 13, 17, 21, 28, 34, 42, 52, 65, 78, 96, 113, 138, 165, 196, 231, 276, 322, 379, 442, 518, 600, 698, 803, 931, 1071, 1231, 1407, 1615, 1839, 2099, 2384, 2712, 3069, 3478, 3923, 4434, 4991, 5618, 6303, 7083, 7928, 8878, 9916, 11081
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 03 2011

Keywords

Examples

			The first terms of A002859 are 1, 3, 4, 5, 6, 8, 10, 12, 17, 21, ...
a(7) = #{6+1, 5+1+1, 4+3, 4+1+1+1, 3+3+1, 3+1+1+1+1, 7x1} = 7;
a(8) = #{8, 6+1+1, 5+3, 5+1+1+1, 4+4, 4+3+1, 4+1+1+1+1, 3+3+1+1, 3+1+1+1+1+1, 8x1} = 10.
		

Crossrefs

Programs

  • Haskell
    a199118 = p a002859_list where
       p _ 0 = 1
       p us'@(u:us) m | m < u     = 0
                      | otherwise = p us' (m - u) + p us m

A199119 Number of partitions of n into distinct terms of (1,3)-Ulam sequence, cf. A002859.

Original entry on oeis.org

1, 1, 0, 1, 2, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 7, 7, 8, 10, 9, 9, 12, 13, 13, 13, 14, 17, 18, 18, 19, 21, 23, 25, 26, 27, 30, 33, 33, 36, 40, 42, 43, 45, 51, 55, 55, 57, 62, 67, 71, 72, 76, 82, 87, 91, 95, 100, 107, 112, 116, 124, 132, 137, 143, 151, 159, 170
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 03 2011

Keywords

Examples

			The first terms of A002859 are 1, 3, 4, 5, 6, 8, 10, 12, 17, 21, ...
a(10) = #{10, 6+4, 6+3+1, 5+4+1} = 4;
a(11) = #{10+1, 8+3, 6+5, 6+4+1} = 4;
a(12) = #{12, 8+4, 8+3+1, 6+5+1, 5+4+3} = 5.
		

Crossrefs

Programs

  • Haskell
    a199119 = p a002859_list where
       p _  0 = 1
       p (u:us) m | m < u = 0
                  | otherwise = p us (m - u) + p us m

A049821 a(n) = j + k, where u(n) = u(j) + u(k) is the unique sum of Ulam numbers described in A002859 (with 1 <= j < k < n).

Original entry on oeis.org

3, 4, 5, 6, 8, 9, 12, 12, 14, 15, 15, 17, 18, 18, 20, 20, 22, 23, 23, 25, 25, 27, 28, 28, 35, 28, 29, 35, 33, 38, 35, 41, 37, 37, 39, 41, 46, 48, 43, 51, 45, 53, 48, 48, 50, 50, 58, 52, 60, 54, 56, 62, 56, 65, 59, 61, 61, 63, 70, 64, 66, 71, 66, 73, 69, 77, 71, 79, 73, 83, 74, 76, 78
Offset: 3

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Nov 20 2019: (Start)
A002859(3) = 4 = 1 + 3 = A002859(1) + A002859(2), so a(3) = 1 + 2 = 3.
A002859(4) = 5 = 1 + 4 = A002859(1) + A002859(3), so a(4) = 1 + 3 = 4.
A002859(5) = 6 = 1 + 5 = A002859(1) + A002859(4), so a(5) = 1 + 4 = 5.
A002859(6) = 8 = 3 + 5 = A002859(2) + A002859(4), so a(6) = 2 + 4 = 6.
A002859(7) = 10 = 4 + 6 = A002859(3) + A002859(5), so a(7) = 3 + 5 = 8.
(End)
		

Crossrefs

Programs

  • Maple
    # First we modify Peter Luschny's program from A002858 (with len >= 3):
    UlamList := proc(len) local isUlam, nextUlam, behead; behead := u -> u[2 .. numelems(u)]; isUlam := proc(n, h, u, r) local hu, tu, hr, tr; hu := u[1]; hr := r[1]; if h = 2 then return false; end if; if hr <= hu then return evalb(h = 1); end if; if hr + hu = n then tu := behead(u); tr := behead(r); return isUlam(n, h + 1, tu, tr); end if; if hr + hu < n then tu := behead(u); return isUlam(n, h, tu, r); end if; tr := behead(r); isUlam(n, h, u, tr); end proc; nextUlam := proc(n, u, r) if isUlam(n, 0, u, r) then if nops(u) = len - 1 then return [op(u), n]; end if; nextUlam(n + 1, [op(u), n], [n, op(r)]); else nextUlam(n + 1, u, r); end if; end proc; nextUlam(3, [1, 3], [3, 1]); end proc:
    # Next we create a function to calculate a(n) for given n >= 3:
    a := proc(n) local u, a, i, j: u := 0: if 3 <= n then a := UlamList(n): for i to n - 2 do for j from i + 1 to n - 1 do if a[n] = a[i] + a[j] then u := i+j: end if: end do: end do: end if: u: end proc:
    # Finally, we create a list of values for a(n):
    seq(a(n), n=3..100); # Petros Hadjicostas, Nov 20 2019

Extensions

Name edited by and typo in the data corrected by Petros Hadjicostas, Nov 20 2019
More terms from Petros Hadjicostas, Nov 20 2019

A049877 a(n) = max(j,k), where u(n) = u(j) + u(k) is the unique sum of Ulam numbers described in A002859 (with 1 <= j < k < n).

Original entry on oeis.org

2, 3, 4, 4, 5, 6, 8, 9, 9, 11, 12, 12, 14, 15, 16, 17, 17, 19, 20, 21, 22, 22, 24, 25, 20, 27, 27, 27, 30, 27, 32, 27, 34, 35, 36, 36, 27, 27, 40, 27, 42, 36, 44, 45, 46, 47, 31, 49, 33, 51, 52, 35, 53, 38, 56, 57, 58, 58, 43, 61, 62, 44, 63, 46, 66, 50, 68, 52, 70, 47, 72, 73, 73, 60
Offset: 3

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Nov 20 2019: (Start)
A002859(3) = 4 = 1 + 3 = A002859(1) + A002859(2), so a(3) = max(1,2) = 2.
A002859(4) = 5 = 1 + 4 = A002859(1) + A002859(3), so a(4) = max(1,3) = 3.
A002859(5) = 6 = 1 + 5 = A002859(1) + A002859(4), so a(5) = max(1,4) = 4.
A002859(6) = 8 = 3 + 5 = A002859(2) + A002859(4), so a(6) = max(2,4) = 4.
A002859(7) = 10 = 4 + 6 = A002859(3) + A002859(5), so a(7) = max(3,5) = 5.
(End)
		

Crossrefs

Programs

  • Maple
    # First we modify Peter Luschny's program from A002858 (with len >= 3):
    UlamList := proc(len) local isUlam, nextUlam, behead; behead := u -> u[2 .. numelems(u)]; isUlam := proc(n, h, u, r) local hu, tu, hr, tr; hu := u[1]; hr := r[1]; if h = 2 then return false; end if; if hr <= hu then return evalb(h = 1); end if; if hr + hu = n then tu := behead(u); tr := behead(r); return isUlam(n, h + 1, tu, tr); end if; if hr + hu < n then tu := behead(u); return isUlam(n, h, tu, r); end if; tr := behead(r); isUlam(n, h, u, tr); end proc; nextUlam := proc(n, u, r) if isUlam(n, 0, u, r) then if nops(u) = len - 1 then return [op(u), n]; end if; nextUlam(n + 1, [op(u), n], [n, op(r)]); else nextUlam(n + 1, u, r); end if; end proc; nextUlam(3, [1, 3], [3, 1]); end proc:
    # Next we create a function to calculate a(n) for given n >= 3:
    a := proc(n) local u, a, i, j: u := 0: if 3 <= n then a := UlamList(n): for i to n - 2 do for j from i + 1 to n - 1 do if a[n] = a[i] + a[j] then u := max(i, j): end if: end do: end do: end if: u: end proc:
    # Finally, we create a list of values for a(n):
    seq(a(n), n=3..100); # Petros Hadjicostas, Nov 20 2019

Extensions

Name edited by and more terms from Petros Hadjicostas, Nov 20 2019

A049878 a(n) = min(j,k), where u(n) = u(j) + u(k) is the unique sum of Ulam numbers described in A002859 (with 1 <= j < k < n).

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 4, 3, 5, 4, 3, 5, 4, 3, 4, 3, 5, 4, 3, 4, 3, 5, 4, 3, 15, 1, 2, 8, 3, 11, 3, 14, 3, 2, 3, 5, 19, 21, 3, 24, 3, 17, 4, 3, 4, 3, 27, 3, 27, 3, 4, 27, 3, 27, 3, 4, 3, 5, 27, 3, 4, 27, 3, 27, 3, 27, 3, 27, 3, 36, 2, 3, 5, 27, 14, 27, 3, 27, 3, 27, 3, 4, 3, 27, 3, 4, 27, 3
Offset: 3

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Nov 20 2019: (Start)
A002859(3) = 4 = 1 + 3 = A002859(1) + A002859(2), so a(3) = min(1,2) = 1.
A002859(4) = 5 = 1 + 4 = A002859(1) + A002859(3), so a(4) = min(1,3) = 1.
A002859(5) = 6 = 1 + 5 = A002859(1) + A002859(4), so a(5) = min(1,4) = 1.
A002859(6) = 8 = 3 + 5 = A002859(2) + A002859(4), so a(6) = min(2,4) = 2.
A002859(7) = 10 = 4 + 6 = A002859(3) + A002859(5), so a(7) = min(3,5) = 3.
(End)
		

Crossrefs

Programs

  • Maple
    # First we modify Peter Luschny's program from A002858 (with len >= 3):
    UlamList := proc(len) local isUlam, nextUlam, behead; behead := u -> u[2 .. numelems(u)]; isUlam := proc(n, h, u, r) local hu, tu, hr, tr; hu := u[1]; hr := r[1]; if h = 2 then return false; end if; if hr <= hu then return evalb(h = 1); end if; if hr + hu = n then tu := behead(u); tr := behead(r); return isUlam(n, h + 1, tu, tr); end if; if hr + hu < n then tu := behead(u); return isUlam(n, h, tu, r); end if; tr := behead(r); isUlam(n, h, u, tr); end proc; nextUlam := proc(n, u, r) if isUlam(n, 0, u, r) then if nops(u) = len - 1 then return [op(u), n]; end if; nextUlam(n + 1, [op(u), n], [n, op(r)]); else nextUlam(n + 1, u, r); end if; end proc; nextUlam(3, [1, 3], [3, 1]); end proc:
    # Next we create a function to calculate a(n) for given n >= 3:
    a := proc(n) local u, a, i, j: u := 0: if 3 <= n then a := UlamList(n): for i to n - 2 do for j from i + 1 to n - 1 do if a[n] = a[i] + a[j] then u := min(i, j): end if: end do: end do: end if: u: end proc:
    # Finally, we create a list of values for a(n):
    seq(a(n), n=3..100); # Petros Hadjicostas, Nov 20 2019

Extensions

Name edited and typo in the data corrected by Petros Hadjicostas, Nov 20 2019
More terms from Petros Hadjicostas, Nov 20 2019

A049879 a(n) = |j - k|, where u(n) = u(j) + u(k) is the unique sum of Ulam numbers described in A002859 (with 1 <= j < k < n).

Original entry on oeis.org

1, 2, 3, 2, 2, 3, 4, 6, 4, 7, 9, 7, 10, 12, 12, 14, 12, 15, 17, 17, 19, 17, 20, 22, 5, 26, 25, 19, 27, 16, 29, 13, 31, 33, 33, 31, 8, 6, 37, 3, 39, 19, 40, 42, 42, 44, 4, 46, 6, 48, 48, 8, 50, 11, 53, 53, 55, 53, 16, 58, 58, 17, 60, 19, 63, 23, 65, 25, 67, 11, 70, 70, 68, 33, 58, 35, 74
Offset: 3

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Nov 20 2019: (Start)
A002859(3) = 4 = 1 + 3 = A002859(1) + A002859(2), so a(3) = |1-2| = 1.
A002859(4) = 5 = 1 + 4 = A002859(1) + A002859(3), so a(4) = |1-3| = 2.
A002859(5) = 6 = 1 + 5 = A002859(1) + A002859(4), so a(5) = |1-4| = 3.
A002859(6) = 8 = 3 + 5 = A002859(2) + A002859(4), so a(6) = |2-4| = 2.
A002859(7) = 10 = 4 + 6 = A002859(3) + A002859(5), so a(7) = |3-5| = 2.
(End)
		

Crossrefs

Programs

  • Maple
    # First we modify Peter Luschny's program from A002858 (with len >= 3):
    UlamList := proc(len) local isUlam, nextUlam, behead; behead := u -> u[2 .. numelems(u)]; isUlam := proc(n, h, u, r) local hu, tu, hr, tr; hu := u[1]; hr := r[1]; if h = 2 then return false; end if; if hr <= hu then return evalb(h = 1); end if; if hr + hu = n then tu := behead(u); tr := behead(r); return isUlam(n, h + 1, tu, tr); end if; if hr + hu < n then tu := behead(u); return isUlam(n, h, tu, r); end if; tr := behead(r); isUlam(n, h, u, tr); end proc; nextUlam := proc(n, u, r) if isUlam(n, 0, u, r) then if nops(u) = len - 1 then return [op(u), n]; end if; nextUlam(n + 1, [op(u), n], [n, op(r)]); else nextUlam(n + 1, u, r); end if; end proc; nextUlam(3, [1, 3], [3, 1]); end proc:
    # Next we create a function to calculate a(n) for given n >= 3:
    a := proc(n) local u, a, i, j: u := 0: if 3 <= n then a := UlamList(n): for i to n - 2 do for j from i + 1 to n - 1 do if a[n] = a[i] + a[j] then u := abs(i-j): end if: end do: end do: end if: u: end proc:
    # Finally, we create a list of values for a(n):
    seq(a(n), n=3..100); # Petros Hadjicostas, Nov 20 2019

Extensions

Name edited by and more terms from Petros Hadjicostas, Nov 20 2019

A002858 Ulam numbers: a(1) = 1; a(2) = 2; for n>2, a(n) = least number > a(n-1) which is a unique sum of two distinct earlier terms.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36, 38, 47, 48, 53, 57, 62, 69, 72, 77, 82, 87, 97, 99, 102, 106, 114, 126, 131, 138, 145, 148, 155, 175, 177, 180, 182, 189, 197, 206, 209, 219, 221, 236, 238, 241, 243, 253, 258, 260, 273, 282, 309, 316, 319, 324, 339
Offset: 1

Views

Author

Keywords

Comments

Ulam conjectured that this sequence has density 0. However, calculations up to 6.759*10^8 (Jud McCranie) indicate that the density hovers near 0.074.
A plot of the first 3 million terms shows that they lie very close to the straight line 13.51*n, so even if we cannot prove it, we believe we now know how this sequence grows (see the plots in the links below). - N. J. A. Sloane, Sep 27 2006
After a few initial terms, the sequence settles into a regular pattern of dense clumps separated by sparse gaps, with period 21.601584+. This pattern continues up to at least a(n) = 5*10^6. (This comment is just a qualitative statement about the wavelike distribution of Ulam numbers, not meant to imply that every period includes Ulam numbers.) - David W. Wilson
_Don Knuth_ (Sep 26 2006) remarks that a(4952)=64420 and a(4953)=64682 (a gap of more than ten "dense clumps"); and there is a gap of 315 between a(18857) and a(18858).
1,2,3,47 are the only values of x < 6.759*10^8 such that x and x+1 are both Ulam numbers. - Jud McCranie, Jun 08 2001. This holds through the first 28 billion Ulam numbers - Jud McCranie, Jan 07 2016.
From Jud McCranie on David W. Wilson's illustration, Jun 20 2008: (Start)
The integers are shown from left to right, top to bottom, with a dot where there is an Ulam number. I think his plot is 216 wide. The local density of Ulam numbers goes in waves with a period of 21.6+, so his plot shows ten cycles.
When they are arranged that way you can see the waves. The crests of the density waves don't always have Ulam numbers there but the troughs are practically void of Ulam numbers. I noticed that the ratio of that period (21.6+) to the frequency of Ulam numbers (1 in 13.52) is very close to 8/5. (End)
a(50000000) = 675904508. - Jud McCranie, Feb 29 2012
a(100000000) = 1351856726. - Jud McCranie, Jul 31 2012
a(1000000000) = 13517664323. - Jud McCranie, Aug 28 2015
a(28000000000) = 378485625853 - Philip Gibbs & Jud McCranie, Sep 09 2015
3 (=1+2) and 131 (=62+69) are the only two Ulam numbers in the first 28 billion Ulam numbers that are the sum of two consecutive Ulam numbers. - Jud McCranie, Jan 09 2016
Named after the Polish-American scientist Stanislaw Ulam (1909-1984). - Amiram Eldar, Jun 08 2021

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.16.2.
  • Richard K. Guy, Unsolved Problems in Number Theory, C4.
  • Donald E. Knuth, The Art of Computer Programming, Volume 4A, Section 7.1.3.
  • 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).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 116.
  • Marvin 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.
  • David Zeitlin, Ulam's sequence {U_n}, U_1=1, U_2=2, is a complete sequence, Notices Amer. Math. Soc., 22 (No. 7, 1975), Abstract 75T-A267, p. A-707.

Crossrefs

Cf. A002859 (version beginning 1,3), A054540, A003667, A001857, A007300, A117140, A214603.
First differences: A072832, A072540.
Cf. A080287, A080288, A004280 (if distinct removed from definition).
See also the density plots in A080573 and A285884.

Programs

  • Haskell
    a002858 n = a002858_list !! (n-1)
    a002858_list = 1 : 2 : ulam 2 2 a002858_list
    ulam :: Int -> Integer -> [Integer] -> [Integer]
    ulam n u us = u' : ulam (n + 1) u' us where
       u' = f 0 (u+1) us'
       f 2 z _                         = f 0 (z + 1) us'
       f e z (v:vs) | z - v <= v       = if e == 1 then z else f 0 (z + 1) us'
                    | z - v `elem` us' = f (e + 1) z vs
                    | otherwise        = f e z vs
       us' = take n us
    -- Reinhard Zumkeller, Nov 03 2011
    
  • Julia
    function isUlam(u, n, h, i, r)
        h == 2 && return false
        ur = u[r]; ui = u[i]
        ur <= ui && return h == 1
        if ur + ui > n
            r -= 1
        elseif ur + ui < n
            i += 1
        else
            h += 1; i += 1; r -= 1
        end
        isUlam(u, n, h, i, r)
    end
    function UlamList(len)
        u = Array{Int, 1}(undef, len)
        u[1] = 1; u[2] = 2; i = 2; n = 2
        while i < len
            n += 1
            if isUlam(u, n, 0, 1, i)
                i += 1
                u[i] = n
            end
        end
        return u
    end
    println(UlamList(59)) # Peter Luschny, Apr 07 2019
    
  • Maple
    UlamList := proc(len) local isUlam, nextUlam, behead; behead := u -> u[2..numelems(u)]; isUlam := proc(n, h, u, r) local hu, tu, hr, tr; hu := u[1]; hr := r[1]; if h = 2 then return false fi; if hr <= hu then return evalb(h = 1) fi; if (hr + hu) = n then tu := behead(u); tr := behead(r); return isUlam(n, h+1, tu, tr) fi; if (hr + hu) < n then tu := behead(u): return isUlam(n, h, tu, r) fi; tr := behead(r); isUlam(n, h, u, tr) end: nextUlam := proc(n, u, r) if isUlam(n, 0, u, r) then if nops(u) = len-1 then return [op(u), n] fi; nextUlam(n+1, [op(u), n], [n, op(r)]) else nextUlam(n+1, u, r) fi end: nextUlam(3, [1, 2], [2, 1]) end:
    UlamList(59); # Peter Luschny, Apr 05 2019
  • Mathematica
    Ulam4Compiled = Compile[{{nmax, _Integer}, {init, _Integer, 1}, {s, _Integer}}, Module[{ulamhash = Table[0, {nmax}], ulam = init}, ulamhash[[ulam]] = 1; Do[ If[Quotient[Plus @@ ulamhash[[i - ulam]], 2] == s, AppendTo[ulam, i]; ulamhash[[i]] = 1], {i, Last[init] + 1, nmax}]; ulam]]; ulams = Ulam4Compiled[355, {1, 2}, 1]
    (* Second program: *)
    ulams = {1, 2}; Do[AppendTo[ulams, n = Last[ulams]; While[n++; Length[DeleteCases[Intersection[ulams, n - ulams], n/2, 1, 1]] != 2]; n], {100}]; ulams (* Jean-François Alcover, Sep 08 2011 *)
    findUlams[s_List, j_Integer] := Block[{k = s[[-1]] + 1, ss = Plus @@@ Subsets[s, {j}]}, While[ Count[ss, k] != 1, k++]; Append[s, k]]; ulams = Nest[findUlams[#, 2] &, {1, 2}, 70] (* Robert G. Wilson v, Jul 05 2014 *)
  • PARI
    aupto(N)= my(seen=vector(N), U=[]); seen[1]=seen[2]=1; for(i=1,N, if(1==seen[i], for(j=1,#U, my(sum=i+U[j]); if(sum>N, break); seen[sum]++); U=concat(U,i))); U \\ Ruud H.G. van Tol, Dec 29 2022
  • Python
    def isUlam(n, h, u, r):
        if h == 2: return False
        hu = u[0]; hr = r[0]
        if hr <= hu: return h == 1
        if hr + hu > n: r = r[1:]
        elif hr + hu < n: u = u[1:]
        else: h += 1; r = r[1:]; u = u[1:]
        return isUlam(n, h, u, r)
    def UlamList(length):
        u = [1, 2]; r = [2, 1]; n = 2
        while len(u) < length:
            n += 1
            if isUlam(n, 0, u[:], r[:]):
                u.append(n); r.insert(0, n)
        return u
    print(UlamList(59)) # Peter Luschny, Apr 06 2019
    

Extensions

More terms from Jud McCranie

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

Views

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]))

A078425 Primes in "Ulam's Prime sequence". A prime is in the sequence iff p+1 can be expressed in exactly 1 way as the sum of 2 previous distinct primes.

Original entry on oeis.org

3, 5, 7, 11, 13, 19, 29, 41, 43, 59, 83, 89, 107, 109, 127, 139, 157, 163, 173, 199, 211, 223, 257, 271, 277, 293, 307, 331, 347, 367, 397, 421, 443, 457, 491, 541, 557, 587, 601, 631, 691, 761, 769, 821, 911, 941, 971, 991, 1009, 1033, 1103, 1129, 1153, 1201
Offset: 1

Views

Author

Jon Perry, Dec 29 2002

Keywords

Comments

a(1) = 3, a(2) = 5; for n >= 3, a(n) is smallest prime which is uniquely a(j) + a(k) - 1, with 1<= j < k < n.
Is the (3,5) sequence finite or infinite? Note that (3,7) as a starting sequence has only 2 terms and (7,11) yields 7, 11, 17, 23, 29 only. Equally using -1 as a rule creates more variants.
The sequence continues at least up to a(2227) = 400031.
After about 500 terms, the graph of this sequences appears almost linear. - T. D. Noe, Jan 20 2008

Examples

			a(3)=7 as 8=3+5. a(4)=11 as 12=5+7 (and nothing else).
		

Crossrefs

Programs

  • PARI
    v=vector(1220);vc=2;v[1]=3;v[2]=5; forprime (p=7,1220,p1=p+1;pc=0;fl=0;for (i=1,vc-1, for (j=i+1,vc,if (v[i]+v[j]==p1,pc++);if (pc>1,fl=1);if (fl,break));if (fl,break));if (pc==0,fl=1);if (!fl,vc++;v[vc]=p));print(vecextract(v,concat("1..",vc)))

Extensions

Edited and extended by Klaus Brockhaus, Apr 14 2005
Showing 1-9 of 9 results.