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.

User: David Spies

David Spies's wiki page.

David Spies has authored 6 sequences.

A275308 Starting terms for the second half of the Kolakoski sequence.

Original entry on oeis.org

2, 1, 2, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1
Offset: 1

Author

David Spies, Jul 22 2016

Keywords

Comments

When building the Kolakoski sequence (A000002) using substitutional generation, this is the first term that comes from the second 2. Or equivalently, this is the first new term added to the previous sequence.

Examples

			.   22
.    ^
.   2211
.     ^
.   221121
.       ^
.   221121221
.         ^
.   22112122122112
.            ^
To obtain the first 5 terms: 2, 1, 2, 2, 2.
		

Crossrefs

Cf. A000002.

A269624 Length of the shortest generalized Roman numeral representation of n.

Original entry on oeis.org

1, 2, 3, 2, 1, 2, 3, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 5, 4, 3, 4, 5, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 5, 4, 3, 4, 5, 6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2
Offset: 1

Author

David Spies, Mar 01 2016

Keywords

Comments

In generalized Roman numerals, any sequence of characters from I,V,X,L,C,D,M can be interpreted uniquely as an (possibly negative) integer. So for instance IIX = 10 - 2 = 8 and IVXX = 20 - (5 - 1) = 16. The rule is: 1. First look for the first instance of the largest character in the string. 2. Everything preceding it is recursively evaluated and subtracted from the value. 3. Everything after it is recursively evaluated and added to the value.

Examples

			For numbers up to 50, one possible shortest representation is: I, II, III, IV, V, VI, VII, IIX, IX, X, XI, XII, XIII, XIV, XV, XVI, XVII, XIIX, XIX, XX, XXI, XXII, XXIII, XXIV, XXV, XXVI, XXVII, XXIIX, XXIX, XXX, XXXI, XXXII, XVIIL, XVIL, XVL, XVLI, XVLII, XIIL, XIL, XL, XLI, XLII, VIIL, VIL, VL, VLI, VLII, IIL, IL, L.
		

Crossrefs

Cf. A006968.

A233423 Values of n at which the period of the continued fraction for sqrt(n) is nondecreasing.

Original entry on oeis.org

1, 2, 3, 6, 7, 13, 19, 21, 22, 31, 43, 46, 76, 94, 124, 133, 139, 151, 166, 211, 214, 244, 301, 309, 331, 421, 526, 571, 604, 631, 751, 886, 919, 991, 1279, 1291, 1324, 1366, 1516, 1621, 1726, 2011, 2311, 2566, 2671, 3004, 3019, 3259, 3334, 3691, 3931, 4174
Offset: 1

Author

David Spies, Dec 09 2013

Keywords

Crossrefs

Superset of A013645.

Programs

  • Mathematica
    t = {1}; mx = 0; n = 1; While[Length[t] < 60, n++; If[! IntegerQ[Sqrt[n]], len = Length[ContinuedFraction[Sqrt[n]][[2]]]; If[len >= mx, AppendTo[t, n]; mx = len]]]; t (* T. D. Noe, Dec 10 2013 *)

Extensions

Extended by T. D. Noe, Dec 10 2013

A225570 The greedy smallest infinite reverse Collatz (3x+1) sequence.

Original entry on oeis.org

1, 2, 4, 8, 16, 5, 10, 20, 40, 13, 26, 52, 17, 34, 11, 22, 7, 14, 28, 56, 112, 37, 74, 148, 49, 98, 196, 65, 130, 43, 86, 172, 344, 688, 229, 458, 916, 305, 610, 203, 406, 812, 1624, 541, 1082, 2164, 721, 1442, 2884, 961, 1922, 3844, 7688, 15376, 5125, 10250
Offset: 1

Author

David Spies, Jul 29 2013

Keywords

Comments

For each a(n) (where n > 4), a(n) = (a(n-1) - 1)/3 if the result is an odd integer not divisible by 3. Otherwise a(n) = 2 * a(n-1).
Going backwards from any term a(n) to a(1), this is the Collatz sequence for a(n). Furthermore, each term in the sequence is the smallest possible term (ignoring multiples of 3) with this property given the previous term.
Multiples of 3 are ignored because after visiting a multiple of 3, subsequent terms can only double.

Crossrefs

Programs

  • Maple
    A225570 := proc(n)
        local a;
        option remember;
        if n <= 4  then
            2^(n-1) ;
        else
            a := (procname(n-1)-1)/3 ;
            if type(a,'integer') and type(a,'odd') and modp(a,3) <> 0 then
                return a;
            else
                return procname(n-1)*2 ;
            end if;
        end if;
    end proc: # R. J. Mathar, Aug 03 2013
  • Mathematica
    last = 8; Join[{1, 2, 4, 8}, Table[test = (last - 1)/3; If[OddQ[last] || ! IntegerQ[test] || IntegerQ[test/3], last = 2*last, last = (last - 1)/3]; last, {96}]] (* T. D. Noe, Aug 11 2013 *)

A217036 Term preceding the first zero in the Fibonacci numbers modulo n.

Original entry on oeis.org

1, 2, 1, 3, 5, 6, 5, 8, 7, 1, 5, 8, 13, 11, 9, 4, 17, 1, 9, 13, 1, 22, 17, 18, 5, 26, 13, 1, 11, 1, 17, 23, 21, 6, 17, 31, 1, 14, 29, 40, 13, 42, 1, 26, 45, 46, 41, 48, 7, 35, 25, 23, 53, 34, 41, 20, 1, 1, 41, 11, 1, 55, 33, 47, 23, 66, 33, 22, 41, 1, 17, 27
Offset: 2

Author

David Spies, Sep 24 2012

Keywords

Comments

The multiplicative order of term n modulo n is given by sequence A001176.
Let M = [{1, 1}, {1, 0}], I = [{1, 0}, {0, 1}] is the 2 X 2 identity matrix, then A001177(n) is the smallest k > 0 such that M^k == r*I (mod n) for some r such that 0 <= r < n, and a(n) gives the value r. - Jianing Song, Jul 04 2019

Programs

  • Maple
    a:= proc(n) local f, g; f, g:= 1, 0;
          while f<>0 do f, g:= irem(f+g, n), f od; g
        end:
    seq(a(n), n=2..100);  # Alois P. Heinz, Sep 24 2012
  • Mathematica
    Table[k = 1; While[Mod[Fibonacci[k], n] > 0, k++]; Mod[Fibonacci[k - 1], n], {n, 2, 100}] (* T. D. Noe, Sep 24 2012 *)
  • PARI
    a(n)=my(a=0,b=1);for(k=1,n^2,[a,b]=[b,(a+b)%n];if(!b,return(a))) \\ Charles R Greathouse IV, Sep 24 2012

Formula

a(n) = F(G(n)-1) mod n where G(n) is sequence A001177 and F(m) is the m-th Fibonacci number. In particular, if n is a Fibonacci number, the n-th term is the previous Fibonacci number.
From Jianing Song, Jul 04 2019: (Start)
Also a(n) = F(G(n)+1) mod n.
a(2^e) = 1 if e = 1, 2, 2^(e-1) + 1 if e >= 3; a(p^e) = a(p)^(p^(e-1)) mod p^e for odd primes p.
For odd primes p, a(p^e) = 1 if and only if A001177(p) == 2 (mod 4); a(p^e) = p^e - 1 if and only if 4 divides A001177(p). (End)

Extensions

a(14)-a(70) from Charles R Greathouse IV, Sep 24 2012

A181988 If n is odd, a(n) = (n+1)/2; if n is even, a(n) = a(n/2) + A003602(n).

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 5, 9, 10, 10, 9, 11, 12, 12, 8, 13, 14, 14, 12, 15, 16, 16, 6, 17, 18, 18, 15, 19, 20, 20, 12, 21, 22, 22, 18, 23, 24, 24, 10, 25, 26, 26, 21, 27, 28, 28, 16, 29, 30, 30, 24, 31, 32, 32, 7, 33, 34, 34, 27, 35, 36
Offset: 1

Author

David Spies, Apr 04 2012

Keywords

Comments

The original definition was "Interleaved multiples of the positive integers".
This sequence is A_1 where A_k = Interleave(k*counting,A_(k+1)).
Show your friends the first 15 terms and see if they can guess term number 16. (If you want to be fair, you might want to show them A003602 first.) - David Spies, Sep 17 2012

Crossrefs

Programs

  • Haskell
    interleave (hdx : tlx) y = hdx : interleave y tlx
    oeis003602 = interleave [1..] oeis003602
    oeis181988 = interleave [1..] (zipWith (+) oeis003602 oeis181988)
    
  • Maple
    nmax:=70: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := n*(p+1) od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Jan 21 2013
  • Python
    from itertools import count
    def interleave(A):
        A1=next(A)
        A2=interleave(A)
        while True:
            yield next(A1)
            yield next(A2)
    def multiples(k):
        return (k*i for i in count(1))
    interleave(multiples(k) for k in count(1))
    
  • Python
    def A181988(n): return (m:=(n&-n).bit_length())*((n>>m)+1) # Chai Wah Wu, Jul 12 2022
    
  • Scheme
    ;; With memoization-macro definec.
    (definec (A181988 n) (if (even? n) (+ (A003602 n) (A181988 (/ n 2))) (A003602 n)))
    ;; Antti Karttunen, Jan 19 2016

Formula

a((2*n-1)*2^p) = n*(p+1), p >= 0.
a(n) = A001511(n)*A003602(n). - L. Edson Jeffery, Nov 21 2015. (Follows directly from above formula.) - Antti Karttunen, Jan 19 2016

Extensions

Definition replaced by a formula provided by David Spies, Sep 17 2012. N. J. A. Sloane, Nov 22 2015