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

A117073 Sequence of which A078783 is the Recamán transform.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 20, 21, 22, 40, 41, 42, 82, 83, 84, 166, 167, 168, 334, 335, 336, 670, 671, 672, 1340, 1341, 1342, 2682, 2683, 2684, 5366, 5367, 5368, 10734, 10735, 10736, 21470, 21471, 21472, 42942, 42943, 42944, 85886, 85887, 85888
Offset: 0

Views

Author

N. J. A. Sloane, Apr 17 2006

Keywords

Comments

The d() sequence mentioned in A078783. Absolute values of first differences of A078783.

References

  • N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

Crossrefs

Cf. A078783.

Programs

  • Haskell
    a117073 n = a117073_list !! n
    -- a117073_list defined in A078783.  -- Reinhard Zumkeller, May 01 2015
  • Mathematica
    b[0] = 0; b[1] = 1;
    b[n_] := b[n] = For[m = 2, True, m++, If[FreeQ[Array[b, n-1], m], If[Abs[m - b[n-1]] > Abs[b[n-1] - b[n-2]], Return[m]]]];
    a[0] = 0; a[n_] := a[n] = Abs[b[n] - b[n-1]];
    Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 0, 50}] (* Jean-François Alcover, Aug 02 2018 *)

A117070 Number at start of segment n of A078783.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 18 2006

Keywords

Comments

a(n) = A078783(3*n-2).

References

  • N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose, unfoldr)
    a117070 n = a117070_list !! (n-1)
    a117070_list = tSegments !! 0
    tSegments = transpose $ unfoldr (Just . splitAt 3) $ tail a078783_list
    -- Reinhard Zumkeller, May 01 2015

A117071 Number at middle of segment n of A078783.

Original entry on oeis.org

3, 7, 14, 26, 49, 92, 177, 346, 683, 1356, 2699, 5384, 10753, 21490, 42963, 85908, 171797, 343574, 687127, 1374232, 2748439, 5496852, 10993677, 21987326, 43974623, 87949216, 175898401, 351796770, 703593507, 1407186980, 2814373925, 5628747814, 11257495591
Offset: 1

Views

Author

N. J. A. Sloane, Apr 18 2006

Keywords

Comments

a(n) = A078783(3*n-1).

References

  • N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

Crossrefs

Programs

  • Haskell
    a117071 n = a117071_list !! (n-1)
    a117071_list = tSegments !! 1
    -- tSegments defined in A117070.  -- Reinhard Zumkeller, May 01 2015

A117072 Number at end of segment n of A078783.

Original entry on oeis.org

6, 13, 25, 48, 91, 176, 345, 682, 1355, 2698, 5383, 10752, 21489, 42962, 85907, 171796, 343573, 687126, 1374231, 2748438, 5496851, 10993676, 21987325, 43974622, 87949215, 175898400, 351796769, 703593506, 1407186979, 2814373924, 5628747813, 11257495590
Offset: 1

Views

Author

N. J. A. Sloane, Apr 17 2006

Keywords

Comments

a(n) = A078783(3*n).

References

  • N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

Crossrefs

Programs

  • Haskell
    a117072 n = a117072_list !! (n-1)
    a117072_list = tSegments !! 2
    -- tSegments defined in A117070.  -- Reinhard Zumkeller, May 01 2015

A257502 Inverse permutation to A078783.

Original entry on oeis.org

0, 1, 4, 2, 7, 10, 3, 5, 13, 16, 19, 22, 25, 6, 8, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 9, 11, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 12, 14, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154
Offset: 0

Views

Author

Reinhard Zumkeller, May 01 2015

Keywords

Crossrefs

Cf. A078783.

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a257502 = fromJust . (`elemIndex` a078783_list)

A081145 a(1)=1; thereafter, a(n) is the least positive integer which has not already occurred and is such that |a(n)-a(n-1)| is different from any |a(k)-a(k-1)| which has already occurred.

Original entry on oeis.org

1, 2, 4, 7, 3, 8, 14, 5, 12, 20, 6, 16, 27, 9, 21, 34, 10, 25, 41, 11, 28, 47, 13, 33, 54, 15, 37, 60, 17, 42, 68, 18, 45, 73, 19, 48, 79, 22, 55, 23, 58, 94, 24, 61, 99, 26, 66, 107, 29, 71, 115, 30, 75, 121, 31, 78, 126, 32, 81, 132, 35, 87, 140, 36, 91, 147, 38, 96, 155, 39
Offset: 1

Views

Author

Don Reble, Mar 08 2003

Keywords

Comments

The sequence is a permutation of the positive integers. The inverse is A081146.
Similar to A100707, except that when we subtract we use the largest possible k.
The 1977 paper of Slater and Velez proves that this sequence is a permutation of positive integers and conjectures that its absolute difference sequence (see A308007) is also a permutation. If we call this the "Slater-Velez permutation of the first kind", then they also constructed another permutation (the 2nd kind), for which they are able to prove that both the sequence (A129198) and its absolute difference (A129199) are true permutations. - Ferenc Adorjan, Apr 03 2007
The points appear to lie on three straight lines of slopes roughly 0.56, 1.40, 2.24 (click "graph", or see the Wilks link). I checked this for the first 10^6 terms using Allan Wilks's C program. See A308009-A308015 for further information about the three lines. - N. J. A. Sloane, May 14 2019

Examples

			a(4)=7 because the previous term is 4 and the differences |3-4|, |5-4| and |6-4| have already occurred.
After 7 we get 3 as the difference 4 has not occurred earlier. 5 follows 14 as the difference 9 has not occurred earlier.
		

Crossrefs

The sequence of differences is A099004 (see also A308007).
Similar to Murthy's sequence A093903, Cald's sequence (A006509) and Recamán's sequence A005132. See also A100707 (another version).
A308021 is an offspring of this sequence. - N. J. A. Sloane, May 13 2019
See A308009-A308015 for the lines that the points lie on.
A308172 gives smallest missing numbers.

Programs

  • Haskell
    import Data.List (delete)
    a081145 n = a081145_list !! (n-1)
    a081145_list = 1 : f 1 [2..] [] where
       f x vs ws = g vs where
         g (y:ys) = if z `elem` ws then g ys else y : f y (delete y vs) (z:ws)
                    where z = abs (x - y)
    -- Reinhard Zumkeller, Jul 02 2015
  • Mathematica
    f[s_] := Block[{d = Abs[Rest@s - Most@s], k = 1}, While[ MemberQ[d, Abs[k - Last@s]] || MemberQ[s, k], k++ ]; Append[s, k]]; NestList[s, {1}, 70] (* Robert G. Wilson v, Jun 09 2006 *)
    f[s_] := Block[{k = 1, d = Abs[Most@s - Rest@s], l = Last@s}, While[MemberQ[s, k] || MemberQ[d, Abs[l - k]], k++ ]; Append[s, k]]; Nest[f, {1}, 70] (* Robert G. Wilson v, Jun 13 2006 *)
  • PARI
    {SV_p1(n)=local(x,v=6,d=2,j,k); /* Slater-Velez permutation - the first kind (by F. Adorjan)*/ x=vector(n);x[1]=1;x[2]=2; for(i=3,n,j=3;k=1;while(k,if(k=bittest(v,j)||bittest(d,abs(j-x[i-1])),j++,v+=2^j;d+=2^abs(j-x[i-1]);x[i]=j))); return(x)} \\ Ferenc Adorjan, Apr 03 2007
    
  • Python
    A081145_list, l, s, b1, b2 = [1,2], 2, 3, set(), set([1])
    for n in range(3, 10**2):
        i = s
        while True:
            m = abs(i-l)
            if not (i in b1 or m in b2):
                A081145_list.append(i)
                b1.add(i)
                b2.add(m)
                l = i
                while s in b1:
                    b1.remove(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 15 2014
    

A064365 a(0) = 0; thereafter a(n) = a(n-1)-prime(n) if positive and new, otherwise a(n) = a(n-1)+prime(n), where prime(n) is the n-th prime.

Original entry on oeis.org

0, 2, 5, 10, 3, 14, 1, 18, 37, 60, 31, 62, 25, 66, 23, 70, 17, 76, 15, 82, 11, 84, 163, 80, 169, 72, 173, 276, 383, 274, 161, 34, 165, 28, 167, 316, 467, 310, 147, 314, 141, 320, 139, 330, 137, 334, 135, 346, 123, 350, 121, 354, 115, 356, 105, 362, 99, 368, 97, 374, 93
Offset: 0

Views

Author

Neil Fernandez, Sep 25 2001

Keywords

Comments

'Recamán transform' (see A005132) of the prime sequence. Note that the definition permits repeated terms [though only by addition] (and there are many repeated terms, just as there are in A005132).
Does every positive integer appear in the sequence? This seems unlikely, since 4 has not appeared in 70000 terms.
Note: this is similar to Clark Kimberling's A022831, except in the latter sequence the words 'and new' have been omitted.
The smallest numbers not occurring in the first million terms: 4, 6, 7, 12, 13, 16, 19, 20, 21, 22, 24, 26, 27, 29, 30, 32, 36, 39, 41, 42. - Reinhard Zumkeller, Apr 26 2012

Examples

			To find a(9) we try subtracting the 9th prime, which is 23, from a(8), which is 37. 37 - 23 = 14, but 14 is already in the sequence (it is a(5)), so we must add. a(9) = 37 + 23 = 60.
		

Crossrefs

Programs

  • Haskell
    import Data.Set (singleton, notMember, insert)
    a064365 n = a064365_list !! n
    a064365_list = 0 : f 0 a000040_list (singleton 0) where
       f x (p:ps) s | x' > 0 && x' `notMember` s = x' : f x' ps (insert x' s)
                    | otherwise                  = xp : f xp ps (insert xp s)
                    where x' = x - p; xp = x + p
    -- Reinhard Zumkeller, Apr 26 2012
    
  • Mathematica
    a = {0}; Do[ If[ a[ [ -1 ] ] - Prime[ n ] > 0 && Position[ a, a[ [ -1 ] ] - Prime[ n ] ] == {}, a = Append[ a, a[ [ -1 ] ] - Prime[ n ] ], a = Append[ a, a[ [ -1 ] ] + Prime[ n ] ] ], {n, 1, 70} ]; a (* Modified by Ivan N. Ianakiev, Aug 05 2019, to accommodate the new initial term of a(0). *)
  • PARI
    A064365(N,s/*=1 to print all terms*/)={ my(a=0,u=0); N & forprime(p=1,prime(N), s & print1(a","); u=bitor(u,2^a+=if(a<=p || bittest(u,a-p),p,-p)));a}  \\ M. F. Hasler, Mar 07 2012
    
  • Python
    from sympy import primerange, prime
    def aupton(terms):
      alst = [0]
      for n, pn in enumerate(primerange(1, prime(terms)+1), start=1):
        x = alst[-1] - pn
        alst += [x if x > 0 and x not in alst else alst[-1] + pn]
      return alst
    print(aupton(60)) # Michael S. Branicky, May 30 2021

Formula

a(n) = A117128(n) - 1. - Thomas Ordowski, Dec 05 2016

Extensions

More terms from Robert G. Wilson v, Sep 26 2001
Further terms from N. J. A. Sloane, Feb 10 2002
Added initial term a(0)=0, in analogy with A128204, A005132, A053461, A117073/A078783. - M. F. Hasler, Mar 07 2012
Showing 1-7 of 7 results.