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-10 of 14 results. Next

A037259 Second differences of A037257.

Original entry on oeis.org

4, 5, 7, 8, 10, 12, 13, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 35, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86
Offset: 0

Views

Author

Keywords

Crossrefs

Formula

a(n) = A037257(n+2) - 2*A037257(n+1) + A037257(n).

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000

A037258 First differences of A037257.

Original entry on oeis.org

2, 6, 11, 18, 26, 36, 48, 61, 75, 90, 106, 123, 142, 163, 185, 208, 232, 257, 285, 314, 344, 375, 407, 440, 474, 509, 546, 585, 625, 666, 708, 751, 795, 840, 886, 933, 982, 1032, 1083, 1135, 1188, 1242, 1297, 1353, 1410, 1468, 1527, 1587, 1649, 1712, 1777
Offset: 0

Views

Author

Keywords

Crossrefs

Formula

a(n) = A037257(n+1) - A037257(n).

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000

A005228 Sequence and first differences (A030124) together list all positive numbers exactly once.

Original entry on oeis.org

1, 3, 7, 12, 18, 26, 35, 45, 56, 69, 83, 98, 114, 131, 150, 170, 191, 213, 236, 260, 285, 312, 340, 369, 399, 430, 462, 495, 529, 565, 602, 640, 679, 719, 760, 802, 845, 889, 935, 982, 1030, 1079, 1129, 1180, 1232, 1285, 1339, 1394, 1451, 1509, 1568, 1628, 1689
Offset: 1

Views

Author

Keywords

Comments

This is the lexicographically earliest sequence that together with its first differences (A030124) contains every positive integer exactly once.
Hofstadter introduces this sequence in his discussion of Scott Kim's "FIGURE-FIGURE" drawing. - N. J. A. Sloane, May 25 2013
A225850(a(n)) = 2*n-1, cf. A167151. - Reinhard Zumkeller, May 17 2013
In view of the definition of A075326: start with a(0) = 0, and extend by rule that the next term is the sum of the predecessor and the most recent non-member of the sequence. - Reinhard Zumkeller, Oct 26 2014

Examples

			Sequence reads 1 3 7 12 18 26 35 45..., differences are 2 4 5, 6, 8, 9, 10 ... and the point is that every number not in the sequence itself appears among the differences. This property (together with the fact that both the sequence and the sequence of first differences are increasing) defines the sequence!
		

References

  • E. Angelini, "Jeux de suites", in Dossier Pour La Science, pp. 32-35, Volume 59 (Jeux math'), April/June 2008, Paris.
  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 73.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A030124 (complement), A037257, A056731, A056738, A140778, A225687.
Cf. A225850, A232746, A232747 (inverse), A232739, A232740, A232750 and also permutation pair A232751/A232752 constructed from this sequence and its complement.
Cf. A001651 (analog with sums instead of differences), A121229 (analog with products).
The same recurrence a(n) = a(n-1) + c(n-1) with different starting conditions: A061577 (starting with 2), A022935 (3), A022936 (4), A022937 (5), A022938 (6).
Related recurrences:
a(n-1) + c(n+1) - A022953, A022954.
a(n-1) + c(n) - A022946 to A022952.
a(n-1) + c(n-2) - A022940, A022941.
a(n-2) + c(n-1) - A022942 to A022944.
a(n-2) + c(n-2) - A022939.
a(n-3) + c(n-3) - A022955.
a(n-4) + c(n-4) - A022956.
a(n-5) + c(n-5) - A022957.

Programs

  • Haskell
    a005228 = scanl (+) 1 a030124
    a030124 = go 1 a005228 where go x ys | x < head ys = x     : go (x + 1) ys
                                         | otherwise   = x + 1 : go (x + 2) (tail ys)
    -- Maks Verver, Jun 30 2025
    
  • Maple
    maxn := 5000; h := array(1..5000); h[1] := 1; a := [1]; i := 1; b := []; for n from 2 to 1000 do if h[n] <> 1 then b := [op(b), n]; j := a[i]+n; if j < maxn then a := [op(a),j]; h[j] := 1; i := i+1; fi; fi; od: a; b; # a is A005228, b is A030124.
    A030124 := proc(n)
        option remember;
        local a,fnd,t ;
        if n <= 1 then
            op(n+1,[2,4]) ;
        else
            for a from procname(n-1)+1 do
                fnd := false;
                for t from 1 to n+1 do
                    if A005228(t)  = a then
                        fnd := true;
                        break;
                    end if;
                end do:
                if not fnd then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    A005228 := proc(n)
        option remember;
        if n <= 2 then
            op(n,[1,3]) ;
        else
            procname(n-1)+A030124(n-2) ;
        end if;
    end proc: # R. J. Mathar, May 19 2013
  • Mathematica
    a = {1}; d = 2; k = 1; Do[ While[ Position[a, d] != {}, d++ ]; k = k + d; d++; a = Append[a, k], {n, 1, 55} ]; a
    (* Second program: *)
    (* Program from Larry Morris, Jan 19 2017: *)
    d = 3; a = {1, 3, 7, 12, 18}; While[ Length[a = Join[a, a[[-1]] + Accumulate[Range[a[[d]] + 1, a[[++d]] - 1]]]] < 50]; a
    (* Comment: This adds as many terms to the sequence as there are numbers in each set of sequential differences. Consequently, the list of numbers it produces may be longer than the limit provided. With the limit of 50 shown, the sequence produced has length 60. *)
  • PARI
    A005228(n,print_all=0,s=1,used=0)={while(n--,used += 1<M. F. Hasler, Feb 05 2013

Formula

a(n) = a(n-1) + c(n-1) for n >= 2, where a(1)=1, a( ) increasing, c( ) = complement of a( ) (c is the sequence A030124).
Let a(n) = this sequence, b(n) = A030124 prefixed by 0. Then b(n) = mex{ a(i), b(i) : 0 <= i < n}, a(n) = a(n-1) + b(n) + 1. (Fraenkel)
a(1) = 1, a(2) = 3; a( ) increasing; for n >= 3, if a(q) = a(n-1)-a(n-2)+1 for some q < n then a(n) = a(n-1) + (a(n-1)-a(n-2)+2), otherwise a(n) = a(n-1) + (a(n-1)-a(n-2)+1). - Albert Neumueller (albert.neu(AT)gmail.com), Jul 29 2006
a(n) = n^2/2 + n^(3/2)/(3*sqrt(2)) + O(n^(5/4)) [proved in Jubin link]. - Benoit Jubin, May 13 2015
For all n >= 1, A232746(a(n)) = n and A232747(a(n)) = n. [Both sequences work as left inverses of this sequence.] - Antti Karttunen, May 14 2015

Extensions

Additional comments from Robert G. Wilson v, Oct 24 2001
Incorrect formula removed by Benoit Jubin, May 13 2015

A030124 Complement (and also first differences) of Hofstadter's sequence A005228.

Original entry on oeis.org

2, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78
Offset: 1

Views

Author

Keywords

Comments

For any n, all integers k satisfying sum(i=1,n,a(i))+1Benoit Cloitre, Apr 01 2002
The asymptotic equivalence a(n) ~ n follows from the fact that the values disallowed in the present sequence because they occur in A005228 are negligible, since A005228 grows much faster than A030124. The next-to-leading term in the formula is calculated from the functional equation F(x) + G(x) = x, suggested by D. Wilson (cf. reference), where F and G are the inverse functions of smooth, increasing approximations f and f' of A005228 and A030124. It seems that higher order corrections calculated from this equation do not agree with the real behavior of a(n). - M. F. Hasler, Jun 04 2008
A225850(a(n)) = 2*n, cf. A167151. - Reinhard Zumkeller, May 17 2013

References

  • E. Angelini, "Jeux de suites", in Dossier Pour La Science, pp. 32-35, Volume 59 (Jeux math'), April/June 2008, Paris.
  • D. R. Hofstadter, "Gödel, Escher, Bach: An Eternal Golden Braid", Basic Books, 1st & 20th anniv. edition (1979 & 1999), p. 73.

Crossrefs

Programs

  • Haskell
    import Data.List (delete)
    a030124 n = a030124_list !! n
    a030124_list = figureDiff 1 [2..] where
       figureDiff n (x:xs) = x : figureDiff n' (delete n' xs) where n' = n + x
    -- Reinhard Zumkeller, Mar 03 2011
  • Mathematica
    (* h stands for Hofstadter's sequence A005228 *) h[1] = 1; h[2] = 3; h[n_] := h[n] = 2*h[n-1] - h[n-2] + If[ MemberQ[ Array[h, n-1], h[n-1] - h[n-2] + 1], 2, 1]; Differences[ Array[h, 69]] (* Jean-François Alcover, Oct 06 2011 *)
  • PARI
    {a=b=t=1;for(i=1,100, while(bittest(t,b++),); print1(b",");t+=1<M. F. Hasler, Jun 04 2008
    

Formula

a(n) = n + sqrt(2n) + o(n^(1/2)). - M. F. Hasler, Jun 04 2008 [proved in Jubin's paper].

Extensions

Changed offset to agree with that of A005228. - N. J. A. Sloane, May 19 2013

A057153 Construct difference array so that (1) first row begins with 1, (2) every row is monotonic increasing, (3) no number appears more than once, (4) smallest number not yet used begins a new row. Sequence gives first row of array.

Original entry on oeis.org

1, 3, 9, 26, 73, 194, 485, 1150, 2617, 5779, 12497, 26653, 56355, 118545, 248605, 520365, 1087853, 2272770, 4748677, 9930475, 20800122, 43658310, 91836751, 193549010, 408449129, 862455193, 1820771343, 3840569196, 8089327515
Offset: 1

Views

Author

Jonas Wallgren, Jul 30 2000

Keywords

Comments

This is the limit of the family of sequences starting with A005228, A037257, A037260. Adjoin next free number as the first element in a new level of differences unless it would produce a duplicate in which case ignore.

Examples

			Array begins
1 3 9 26 73 194 ...
.2 6 17 47 121 ...
. 4 11 30 74 ...
.. 7 19 44 ...
... 12 25 ...
.... 13 ...
		

Crossrefs

Cf. A057154 (numbers not used), A052474 (main diagonal), A056230 (array). See also A005228, A037257, A037260, A057267, A056231, A056232, A056233, A056234.
Cf. A133544.
Cf. A200379 (first differences).

Programs

Formula

Row sums of triangle A133544. - Gary W. Adamson, Sep 14 2007

Extensions

More terms from Rob Speer (rob(AT)twcny.rr.com) and Loren Merritt, Aug 14 2000

A225376 Construct sequences P,Q,R by the rules: Q = first differences of P, R = second differences of P, P starts with 1,5,11, Q starts with 4,6, R starts with 2; at each stage the smallest number not yet present in P,Q,R is appended to R; every number appears exactly once in the union of P,Q,R. Sequence gives P.

Original entry on oeis.org

1, 5, 11, 20, 36, 60, 94, 140, 199, 272, 360, 465, 588, 730, 893, 1078, 1286, 1519, 1778, 2064, 2378, 2721, 3094, 3498, 3934, 4403, 4907, 5448, 6027, 6645, 7303, 8002, 8743, 9527, 10355, 11228
Offset: 1

Views

Author

N. J. A. Sloane, May 12 2013, based on email from Christopher Carl Heckman, May 06 2013

Keywords

Comments

P can be extended for 10^6 terms, but it is not known if P,Q,R can be extended to infinity.
A probabilistic argument suggests that P, Q, R are infinite. - N. J. A. Sloane, May 19 2013
Martin Gardner (see reference) states that no such triple P,Q,R of sequences exists if it is required that P(1)

Examples

			The initial terms of P, Q, R are:
1     5    11    20    36    60    94   140   199   272   360
   4     6     9    16    24    34    46    59    73    88
      2     3     7     8    10    12    13    14    15
		

References

  • M. Gardner, Weird Numbers from Titan, Isaac Asimov's Science Fiction Magazine, Vol. 4, No. 5, May 1980, pp. 42ff.

Crossrefs

Programs

  • Maple
    Hofstadter2 := proc (N) local h, dh, ddh, S, lbmex, i:
        h := 1, 5, 11: dh := 4, 6: ddh := 2:
        lbmex := 3: S := {h,dh,ddh}:
        for i from 4 to N do:
           while lbmex in S do: S := S minus {lbmex}: lbmex := lbmex + 1: od:
           ddh := ddh, lbmex:
           dh := dh, dh[-1] + lbmex:
           h := h, h[-1] + dh[-1]:
           S := S union {h[-1], dh[-1], ddh[-1]}:
           lbmex := lbmex + 1:
        od:
        if {h} intersect {dh} <> {} then: return NULL:
        elif {h} intersect {ddh} <> {} then: return NULL:
        elif {ddh} intersect {dh} <> {} then: return NULL:
        else: return [h]: fi:
    end proc: # Christopher Carl Heckman, May 12 2013
  • Mathematica
    Hofstadter2[N_] := Module[{P, Q, R, S, k, i}, P = {1, 5, 11}; Q = {4, 6}; R = {2}; k = 3; S = Join[P, Q, R]; For[i = 4, i <= N, i++, While[MemberQ[S, k], S = S~Complement~{k}; k++]; AppendTo[R, k]; AppendTo[Q, Q[[-1]] + k]; AppendTo[P, P[[-1]] + Q[[-1]]]; S = S~Union~{P[[-1]], Q[[-1]], R[[-1]]}; k++]; Which[P~Intersection~Q != {}, Return@Nothing, {P}~Intersection~R != {}, Return@Nothing, R~Intersection~Q != {}, Return@Nothing, True, Return@P]];
    Hofstadter2[36] (* Jean-François Alcover, Mar 05 2023, after Christopher Carl Heckman's Maple code *)

Extensions

Corrected and edited by Christopher Carl Heckman, May 12 2013

A225377 Construct sequences P,Q,R by the rules: Q = first differences of P, R = second differences of P, P starts with 1,5,11, Q starts with 4,6, R starts with 2; at each stage the smallest number not yet present in P,Q,R is appended to R; every number appears exactly once in the union of P,Q,R. Sequence gives Q.

Original entry on oeis.org

4, 6, 9, 16, 24, 34, 46, 59, 73, 88, 105, 123, 142, 163, 185, 208, 233, 259, 286, 314, 343, 373, 404, 436, 469, 504, 541, 579, 618, 658, 699, 741, 784, 828, 873, 920, 968, 1017, 1067, 1118, 1170
Offset: 1

Author

N. J. A. Sloane, May 12 2013, based on email from Christopher Carl Heckman, May 06 2013

Keywords

Comments

P can be extended for 10^6 terms, but it is not known if P,Q,R can be extended to infinity.
A probabilistic argument suggests that P, Q, R are infinite. - N. J. A. Sloane, May 19 2013

Examples

			The initial terms of P, Q, R are:
1     5    11    20    36    60    94   140   199   272   360
   4     6     9    16    24    34    46    59    73    88
      2     3     7     8    10    12    13    14    15
		

Crossrefs

Programs

Extensions

Corrected and edited by Christopher Carl Heckman, May 12 2013

A225378 Construct sequences P,Q,R by the rules: Q = first differences of P, R = second differences of P, P starts with 1,5,11, Q starts with 4,6, R starts with 2; at each stage the smallest number not yet present in P,Q,R is appended to R; every number appears exactly once in the union of P,Q,R. Sequence gives R.

Original entry on oeis.org

2, 3, 7, 8, 10, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 62, 63, 64
Offset: 1

Author

N. J. A. Sloane, May 12 2013, based on email from Christopher Carl Heckman, May 06 2013

Keywords

Comments

P can be extended for 10^6 terms, but it is not known if P,Q,R can be extended to infinity.
A probabilistic argument suggests that P, Q, R are infinite. - N. J. A. Sloane, May 19 2013

Examples

			The initial terms of P, Q, R are:
1     5    11    20    36    60    94   140   199   272   360
   4     6     9    16    24    34    46    59    73    88
      2     3     7     8    10    12    13    14    15
		

Crossrefs

Programs

Extensions

Corrected and edited by Christopher Carl Heckman, May 12 2013

A140778 a(n) is the smallest positive integer such that no number occurs twice in the union of the sequence and its absolute first differences.

Original entry on oeis.org

1, 3, 7, 12, 18, 8, 17, 28, 13, 27, 43, 19, 39, 60, 22, 45, 70, 26, 55, 85, 31, 63, 96, 34, 69, 105, 37, 77, 118, 42, 88, 135, 48, 97, 147, 52, 103, 156, 56, 113, 171, 59, 120, 184, 65, 131, 198, 71, 143, 216, 74, 149, 227, 79, 159, 240, 82, 165, 249, 86, 175, 265, 91, 183
Offset: 1

Author

Keywords

Comments

This sequence and its first differences include every positive integer (exactly once).

Examples

			For a(5), the sequence to that point is [1,3,7,12], with absolute differences [2,4,5]. The next number cannot be 6, because then 6 would be in both the sequence and the first differences. Since all values smaller than 6 are taken, the difference must be positive and at least 6. A difference of 6 works, a(5) = 18.
		

Programs

  • Maple
    b:= proc() false end:
    a:= proc(n) option remember; local k;
          if n=1 then b(1):= true; 1
        else for k while b(k) or (t-> b(t) or t=k)(abs(a(n-1)-k)) do od;
             b(k), b(abs(a(n-1)-k)):= true$2; k
          fi
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, May 14 2015
  • Mathematica
    a[n_] := a[n] = Module[{}, If [n == 1, b[1] = True; 1, For[k = 1, b[k] || Function[t, b[t] || t == k][Abs[a[n-1] - k]], k++]; {b[k], b[Abs[a[n-1] - k]]} = {True, True}; k]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 22 2017, after Alois P. Heinz *)
  • PARI
    IsInList(v, k) = for(i=1,#v,if(v[i]==k,return(1)));return(0) IsInDiff(v, k) = for(i=2,#v,if(abs(v[i]-v[i-1])==k,return(1)));return(0) NextA140778(v)={ local(i,d); if(#v==0,return(1)); i=2; while(1, d=abs(i-v[ #v]); if(!(i==d || IsInList(v,i) || IsInDiff(v,i) || IsInList(v,d) || IsInDiff(v,d)), return(i)); i++) } v=[];for(i=1,100,v=concat(v,NextA140778(v)));v
    
  • PARI
    {u=0;a=1;for(n=1,99,u+=1<M. F. Hasler, May 13 2015

A037260 a()=A037260 and its first [ A037261 ], 2nd [ A037262 ] and 3rd [ A037263 ] differences together include every number at most once and are monotonic and minimal.

Original entry on oeis.org

1, 3, 9, 26, 62, 127, 233, 393, 621, 932, 1342, 1869, 2533, 3355, 4357, 5562, 6994, 8678, 10641, 12911, 15518, 18493, 21868, 25676, 29951, 34728, 40044, 45937, 52446, 59611, 67474, 76078, 85467, 95686, 106781, 118799, 131788, 145797
Offset: 0

Keywords

Comments

5 is the only number less than 100 not used in any of the 4 sequences - Larry Reeves (larryr(AT)acm.org), Sep 25 2000

Examples

			After 1 3 9 26 62
------ 2 6 17 36
------- 4 11 19
-------- 7 8
the next free number is 10 which we CAN add to 4th row.
		

Crossrefs

A037260-A037263 are 4-rowed analog of A037257-A037259. See A005228, A030124 for 2-rowed version.

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000
Showing 1-10 of 14 results. Next