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 29 results. Next

A202342 Numbers occurring exactly twice in Hofstadter H-sequence A005374.

Original entry on oeis.org

1, 4, 5, 7, 10, 13, 14, 17, 18, 20, 23, 24, 26, 29, 32, 33, 35, 38, 41, 42, 45, 46, 48, 51, 54, 55, 58, 59, 61, 64, 65, 67, 70, 73, 74, 77, 78, 80, 83, 84, 86, 89, 92, 93, 95, 98, 101, 102, 105, 106, 108, 111, 112, 114, 117, 120, 121, 123, 126, 129, 130, 133
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 17 2011

Keywords

Comments

Position of the n-th occurrence of the digit 1 in A105083(n-1) for n>=1. - Jeffrey Shallit, Mar 08 2025

Crossrefs

Cf. A005374, A105083, A202340, A136495, A136496, A202341 (complement).

Programs

  • Haskell
    import Data.List (elemIndices)
    a202342 n = a202342_list !! (n-1)
    a202342_list = elemIndices 2 a202340_list

Formula

A202340(a(n)) = 2.
a(n) = A005374(A136496(n)). - Alan Michael Gómez Calderón, Dec 22 2024
a(n) = A136495(A136495(n)). - Alan Michael Gómez Calderón, Jan 06 2025

A202340 Number of times n occurs in Hofstadter H-sequence A005374.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 17 2011

Keywords

Comments

a(A202341(n)) = 1; a(A202342(n)) = 2.

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a202340 n = a202340_list !! n
    a202340_list = map length $ group a005374_list

Formula

a(n) = A136495(n+1) - A136495(n) for n > 0. - Alan Michael Gómez Calderón, Dec 23 2024

A202341 Numbers occurring exactly once in Hofstadter H-sequence A005374.

Original entry on oeis.org

0, 2, 3, 6, 8, 9, 11, 12, 15, 16, 19, 21, 22, 25, 27, 28, 30, 31, 34, 36, 37, 39, 40, 43, 44, 47, 49, 50, 52, 53, 56, 57, 60, 62, 63, 66, 68, 69, 71, 72, 75, 76, 79, 81, 82, 85, 87, 88, 90, 91, 94, 96, 97, 99, 100, 103, 104, 107, 109, 110, 113, 115, 116, 118
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 17 2011

Keywords

Comments

A202340(a(n)) = 1.

Crossrefs

Cf. A005374, A202340, A202342 (complement).

Programs

  • Haskell
    import Data.List (elemIndices)
    a202341 n = a202341_list !! (n-1)
    a202341_list = elemIndices 1 a202340_list

A154951 Found by taking the tree defined by the Hofstadter H-sequence (A005374), mirroring it left to right and relabeling the nodes so they increase left to right. a(n) is the parent node of node n in the tree so constructed.

Original entry on oeis.org

0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 28, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 43, 43, 44, 44, 45, 46, 47, 47
Offset: 0

Views

Author

David Fifield, Jan 17 2009

Keywords

References

  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Basic Books, 1999, p. 137.

Crossrefs

Programs

  • Python
    # Emulate a breadth-first traversal of the "flip"
    # of the tree defined by the Hofstadter H-sequence.
    def hflip_iter():
        yield 0
        yield 1
        # Start on the first node of a left branch, parent node is 1.
        queue = [(1, 1)]
        n = 2
        while True:
            parent, state = queue.pop(0)
            yield parent
            if state == 0:
                # Root node. Add the two children.
                queue.append((n, 1))
                queue.append((n, 0))
            elif state == 1:
                # First node on left branch. Add the second node.
                queue.append((n, 2))
            elif state == 2:
                # Second node on left branch. Add a new root.
                queue.append((n, 0))
            n += 1
    i = hflip_iter()
    for n in range(0, 10001):
        print("%d %d" % (n, next(i)))

A082401 a(n)=A005374(n)-floor(r*n) where r is the positive root of x^3+x-1=0.

Original entry on oeis.org

0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1
Offset: 0

Views

Author

Benoit Cloitre, Apr 15 2003

Keywords

Formula

It seems that sum(k=1, n, a(k)) is asymptotic to C*n where C=0.53...>1/2

A005185 Hofstadter Q-sequence: a(1) = a(2) = 1; a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 2.

Original entry on oeis.org

1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 6, 8, 8, 8, 10, 9, 10, 11, 11, 12, 12, 12, 12, 16, 14, 14, 16, 16, 16, 16, 20, 17, 17, 20, 21, 19, 20, 22, 21, 22, 23, 23, 24, 24, 24, 24, 24, 32, 24, 25, 30, 28, 26, 30, 30, 28, 32, 30, 32, 32, 32, 32, 40, 33, 31, 38, 35, 33, 39, 40, 37, 38, 40, 39
Offset: 1

Views

Author

Simon Plouffe and N. J. A. Sloane, May 20 1991

Keywords

Comments

Rate of growth is not known. In fact it is not even known if this sequence is defined for all positive n.
Roman Pearce, Aug 29 2014, has computed that a(n) exists for n <= 10^10. - N. J. A. Sloane
a(n) exists for n <= 3*10^10. - M. Eric Carr, Jul 02 2023

Examples

			a(18) = 11 because a(17) is 10 and a(16) is 9, so we take a(18 - 10) + a(18 - 9) = a(8) + a(9) = 5 + 6 = 11.
		

References

  • B. W. Conolly, "Meta-Fibonacci sequences," in S. Vajda, editor, Fibonacci and Lucas Numbers and the Golden Section. Halstead Press, NY, 1989, pp. 127-138.
  • R. K. Guy, Unsolved Problems in Number Theory, Sect. E31.
  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 138.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Vajda, Fibonacci and Lucas Numbers and the Golden Section, Wiley, 1989, see p. 129.
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.

Crossrefs

Cf. A081827 (first differences).
Cf. A226244, A226245 (record values and where they occur).
See A244477 for a different start.

Programs

  • C
    #include 
    #define LIM 20
    int Qa[LIM];
    int Q(int n){if (n==1 || n==2){return 1;} else{return Qa[n-Qa[n-1]]+Qa[n-Qa[n-2]];}}
    int main(){int i;printf("n\tQ\n");for(i=1; iGonzalo Ciruelos, Aug 01 2013
    
  • Haskell
    a005185 n = a005185_list !! (n-1)
    a005185_list = 1 : 1 : zipWith (+)
       (map a005185 $ zipWith (-) [3..] a005185_list)
       (map a005185 $ zipWith (-) [3..] $ tail a005185_list)
    -- Reinhard Zumkeller, Jun 02 2013, Sep 15 2011
    
  • Magma
    I:=[1,1]; [n le 2 select I[n] else Self(n-Self(n-1))+Self(n-Self(n-2)): n in [1..90]]; // Vincenzo Librandi, Aug 08 2014
    
  • Maple
    A005185 := proc(n) option remember;
        if n<=2 then 1
        elif n > procname(n-1) and n > procname(n-2) then
            RETURN(procname(n-procname(n-1))+procname(n-procname(n-2)));
        else
            ERROR(" died at n= ", n);
        fi; end proc;
    # More generally, the following defines the Hofstadter-Huber sequence Q(r,s) - N. J. A. Sloane, Apr 15 2014
    r:=1; s:=2;
    a:=proc(n) option remember; global r,s;
    if n <= s then  1
    else
        if (a(n-r) <= n) and (a(n-s) <= n) then
        a(n-a(n-r))+a(n-a(n-s));
        else lprint("died with n =",n); return (-1);
        fi; fi; end;
    [seq(a(n), n=1..100)];
  • Mathematica
    a[1]=a[2]=1; a[n_]:= a[n]= a[n -a[n-1]] + a[n -a[n-2]]; Table[ a[n], {n,70}]
  • MuPAD
    q:=proc(n) option remember; begin if n<=2 then 1 else q(n-q(n-1))+q(n-q(n-2)) end_if; end_proc: q(i)$i=1..100; // Zerinvary Lajos, Apr 03 2007
    
  • PARI
    {a(n)= local(A); if(n<1, 0, A=vector(n,k,1); for(k=3, n, A[k]= A[k-A[k-1]]+ A[k-A[k-2]]); A[n])} /* Michael Somos, Jul 16 2007 */
    
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def a(n):
        if n < 3: return 1
        return a(n - a(n-1)) + a(n - a(n-2))
    print([a(n) for n in range(1, 75)]) # Michael S. Branicky, Jul 26 2021
  • Sage
    @CachedFunction
    def a(n):
        if (n<3): return 1
        else: return a(n -a(n-1)) + a(n -a(n-2))
    [a(n) for n in (1..70)] # G. C. Greubel, Feb 13 2020
    
  • Scheme
    (define q (lambda (n) (cond ( (eqv? n 0) 1) ( (eqv? n 1) 1) ( #t (+ (q (- n (q (- n 1)))) (q (- n (q (- n 2)))))))))
    
  • Scheme
    ;; An implementation of memoization-macro definec can be found for example in: http://oeis.org/wiki/Memoization
    (definec (A005185 n) (if (<= n 2) 1 (+ (A005185 (- n (A005185 (- n 1)))) (A005185 (- n (A005185 (- n 2)))))))
    ;; Antti Karttunen, Mar 22 2017
    

A005206 Hofstadter G-sequence: a(0) = 0; a(n) = n - a(a(n-1)) for n > 0.

Original entry on oeis.org

0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 46, 47
Offset: 0

Views

Author

Keywords

Comments

Rule for finding n-th term: a(n) = An, where An denotes the Fibonacci antecedent to (or right shift of) n, which is found by replacing each F(i) in the Zeckendorf expansion (obtained by repeatedly subtracting the largest Fibonacci number you can until nothing remains) by F(i-1) (A1=1). For example: 58 = 55 + 3, so a(58) = 34 + 2 = 36. - Diego Torres (torresvillarroel(AT)hotmail.com), Nov 24 2002
From Albert Neumueller (albert.neu(AT)gmail.com), Sep 28 2006: (Start)
A recursively built tree structure can be obtained from the sequence (see Hofstadter, p. 137):
14 15 16 17 18 19 20 21
\ / / \ / \ / /
9 10 11 12 13
\ / / \ /
6 7 8
\ / /
\ / /
\ / /
4 5
\ /
\ /
\ /
\ /
\ /
3
/
2
\ /
1
To construct the tree: node n is connected with the node a(n) below
n
/
a(n)
For example, since a(7) = 4:
7
/
4
If the nodes of the tree are read from bottom to top, left to right, one obtains the positive integers: 1, 2, 3, 4, 5, 6, ... The tree has a recursive structure, since the construct
/
x
\ /
x
can be repeatedly added on top of its own ends, to construct the tree from its root: e.g.,
/
x
/ \ /
x x
\ / /
x x
\ /
\ /
x
When moving from a node to a lower connected node, one is moving to the parent. Parent node of n: floor((n+1)/tau). Left child of n: floor(tau*n). Right child of n: floor(tau*(n+1))-1 where tau=(1+sqrt(5))/2. (See the Sillke link.)
(End)
The number n appears A001468(n) times; A001468(n) = floor((n+1)*Phi) - floor(n*Phi) with Phi = (1 + sqrt 5)/2. - Philippe Deléham, Sep 22 2005
Number of positive Wythoff A-numbers A000201 not exceeding n. - N. J. A. Sloane, Oct 09 2006
Number of positive Wythoff B-numbers < A000201(n+1). - N. J. A. Sloane, Oct 09 2006
From Bernard Schott, Apr 23 2022: (Start)
Properties coming from the 1st problem proposed during the 45th Czech and Slovak Mathematical Olympiad in 1996 (see IMO Compendium link):
-> a(n) >= a(n-1) for any positive integer n,
-> a(n) - a(n-1) belongs to {0,1},
-> No integer n exists such that a(n-1) = a(n) = a(n+1). (End)
For n >= 1, find n in the Wythoff array (A035513). a(n) is the number that precedes n in its row, using the preceding column of the extended Wythoff array (A287870) if n is at the start of the (unextended) row. - Peter Munn, Sep 17 2022
See my 2023 publication on Hofstadter's G-sequence for a proof of the equality of (a(n)) with the sequence A073869. - Michel Dekking, Apr 28 2024
From Michel Dekking, Dec 16 2024: (Start)
Focus on the pairs of duplicate values, i.e., the pairs (a(n-1),a(n)) with a(n-1) = a(n). Directly from Theorem 1 in Kimberling and Stolarsky (2016) one derives that the m-th pair of duplicate values (a(n-1),a(n)) occurs at n = U(m), where U = 2,5,7,10,... is the upper Wythoff sequence. For example, (3,3) is the second pair, and occurs at U(2) = 5.
This property can be used to give a simple construction for (a(n)) -- ignoring the superfluous a(0) = 0.
Let 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,... be the sequence of positive natural numbers. Double all the elements of the lower Wythoff sequence (L(n)) = 1,3,4,6,8,9,11,....:
(x(n)) := 1,1, 2, 3,3, 4,4, 5, 6,6, 7, 8,8, 9,9, 10,....
Claim: the result is (a(n)). This follows since because of the doubling, the m-th pair of duplicate values (a(n-1),a(n)) occurs in x at n = L(m) + m = U(m). The second equality by a well-known formula.
It follows from this by Theorem 1 of K&S, that a(n-1) = x(n-1), and a(n) = x(n) if n = U(m), for all m. But since L and U are complementary sequences, a(n) = x(n) will also hold if n = L(k), for all k. For example, L(4) = 6, and a(6) = x(6) = 4.
Corollary: for n >= 2 replace every pair of duplicate values (a(n-1),a(n)) by 0, and all the remaining elements of (a(n)) by 1. Then the result is the Fibonacci word 0,1,0,0,1,0,1,0,0... This is implied by the fact that L gives the positions of the 0s, and U the position of the 1's in the Fibonacci word. (End)
For all n >= 0, a(n) <= A005374(n), as proved in Letouzey-Li-Steiner link. Last equality occurs at n = 12, while a(n) < A005374(n) afterwards. - Pierre Letouzey, Feb 20 2025

References

  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 137.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Apart from initial terms, same as A060143. Cf. A123070.
a(n):=Sum{k=1..n} h(k), n >= 1, with h(k):= A005614(k-1) and a(0):=0.

Programs

  • Haskell
    a005206 n = a005206_list !! n
    a005206_list = 0 : zipWith (-) [1..] (map a005206 a005206_list)
    -- Reinhard Zumkeller, Feb 02 2012, Aug 07 2011
    
  • Haskell
    a005206 = sum . zipWith (*) a000045_list . a213676_row . a000201 . (+ 1)
    -- Reinhard Zumkeller, Mar 10 2013
    
  • Magma
    [Floor((n+1)*(1+Sqrt(5))/2)-n-1: n in [0..80]]; // Vincenzo Librandi, Nov 19 2016
    
  • Maple
    H:=proc(n) option remember; if n=0 then 0 elif n=1 then 1 else n-H(H(n-1)); fi; end proc: seq(H(n),n=0..76);
  • Mathematica
    a[0] = 0; a[n_] := a[n] = n - a[a[n - 1]]; Array[a, 77, 0]
    (* Second program: *)
    Fold[Append[#1, #2 - #1[[#1[[#2]] + 1 ]] ] &, {0}, Range@ 76] (* Michael De Vlieger, Nov 13 2017 *)
  • PARI
    first(n)=my(v=vector(n)); v[1]=1; for(k=2,n, v[k]=k-v[v[k-1]]); concat(0,v) \\ Charles R Greathouse IV, Sep 02 2015
    
  • Python
    from math import isqrt
    def A005206(n): return (n+1+isqrt(5*(n+1)**2)>>1)-n-1 # Chai Wah Wu, Aug 09 2022

Formula

a(n) = floor((n+1)*tau) - n - 1 = A000201(n+1)-n-1, where tau = (1+sqrt(5))/2; or a(n) = floor(sigma*(n+1)) where sigma = (sqrt(5)-1)/2.
a(0)=0, a(1)=1, a(n) = n - a(floor(n/tau)). - Benoit Cloitre, Nov 27 2002
a(n) = A019446(n) - 1. - Reinhard Zumkeller, Feb 02 2012
a(n) = n - A060144(n+1). - Reinhard Zumkeller, Apr 07 2012
a(n) = Sum_{k=1..A072649(m)} A000045(m)*A213676(m,k): m=A000201(n+1). - Reinhard Zumkeller, Mar 10 2013
From Pierre Letouzey, Sep 09 2015: (Start)
a(n + a(n)) = n.
a(n) + a(a(n+1) - 1) = n.
a(0) = 0, a(n+1) = a(n) + d(n) and d(0) = 1, d(n+1)=1-d(n)*d(a(n)). (End)
a(n) = A293688(n)/(n+1) for n >= 0 (conjectured). - Enrique Navarrete, Oct 15 2017
A generalization of Diego Torres's 2002 comment as a formula: if n = Sum_{i in S} A000045(i+1), where S is a set of positive integers, then a(n) = Sum_{i in S} A000045(i). - Peter Munn, Sep 28 2022
Conjectures from Chunqing Liu, Aug 01 2023: (Start)
a(A000201(n)-1) = n-1.
a(A001950(n)-1) = a(A001950(n)) = A000201(n). (End)

Extensions

a(0) = 0 added in the Name by Bernard Schott, Apr 23 2022

A136495 Solution of the complementary equation b(n)=a(a(n))+n.

Original entry on oeis.org

1, 3, 4, 5, 7, 9, 10, 12, 13, 14, 16, 17, 18, 20, 22, 23, 24, 26, 28, 29, 31, 32, 33, 35, 37, 38, 40, 41, 42, 44, 45, 46, 48, 50, 51, 53, 54, 55, 57, 58, 59, 61, 63, 64, 65, 67, 69, 70, 72, 73, 74, 76, 77, 78, 80, 82, 83, 84, 86, 88, 89, 91, 92, 93, 95, 97, 98, 100, 101, 102
Offset: 1

Views

Author

Clark Kimberling, Jan 01 2008

Keywords

Comments

b = 1 + (column 1 of Z) = 1 + A020942. The pair (a,b) also satisfy the following complementary equations: b(n)=a(a(a(n)))+1; a(b(n))=a(n)+b(n); b(a(n))=a(n)+b(n)-1; (and others).
Let Z = (3rd order Zeckendorf array) = A136189. Then a = ordered union of columns 1,3,4,6,7,9,10,12,13,... of Z, b = ordered union of columns 2,5,8,11,14,... of Z.
Position of the n-th occurrence of either 1 or 3 in A105083(n-1) for n>=1. - Jeffrey Shallit, Mar 08 2025

Examples

			b(1) = a(a(1))+1 = a(1)+1 = 1+1 = 2;
b(2) = a(a(2))+2 = a(3)+2 = 4+2 = 6;
b(3) = a(a(3))+3 = a(4)+3 = 5+3 = 8;
b(4) = a(a(4))+4 = a(5)+4 = 7+4 = 11.
		

References

  • Clark Kimberling and Peter J. C. Moses, Complementary equations and Zeckendorf arrays, in Applications of Fibonacci Numbers, vol.10, Proceedings of the Thirteenth International Conference on Fibonacci Numbers and Their Applications, William Webb, editor, Congressus Numerantium, Winnipeg, Manitoba 201 (2010) 161-178.

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a136495 n = (fromJust $ n `elemIndex` tail a005374_list) + 1
    -- Reinhard Zumkeller, Dec 17 2011

Formula

A005374(a(n)) = n. - Reinhard Zumkeller, Dec 17 2011
a(n) = A005374(A005374(n-1)) + n. - Alan Michael Gómez Calderón, Jul 16 2025

A105083 Trajectory of 1 under the morphism 1 -> 12, 2 -> 3, 3 -> 1.

Original entry on oeis.org

1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 2
Offset: 0

Views

Author

Roger L. Bagula, Apr 06 2005

Keywords

Crossrefs

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {1 -> {1, 2}, 2 -> {3}, 3 -> {1}})] }], {1}, 12]
  • Python
    N_TERMS=10000
    def a():
      # Index of the current term
      n = 0
      # Stores the place values of the greedy representation of n,
      # minus two since A000930 begins with duplicate ones.
      places = []
      # Edge case: a(0)=1.
      yield 0, 1
      while True:
        n += 1
        # Add A000930(2+0)=1 to the representation of n
        places.append(0)
        # Apply carryover rule for as long as necessary:
        # if places contains n+2 and n,
        # both terms are replaced by n+3.
        while len(places) > 1 and places[-2] <= places[-1]+2:
          places.pop()
          places[-1] += 1
        # Look at the smallest term to decide a(n)
        an = 1 if places[-1] > 1 else places[-1]+2
        yield n, an
    # Asymptotic behavior is O(log(n)*log(log(n))) memory
    # and O(n) time to generate the first n terms,
    # although a term may take as long as O(log(n)).
    for n, an in a():
      print(n, an)
      if (n >= N_TERMS):
        break
    # Aresh Pourkavoos, Jan 26 2021

Formula

From Aresh Pourkavoos, Jan 26 2021: (Start)
Limit S(infinity) of the following strings: S(0) = 2, S(1) = 1, S(2) = 0, S(n+3) = S(n+2)S(n). S(n) has length A000930(n).
Individual terms of a(n) may also be found by greedily writing n as a sum of entries of A000930. a(n) is 2 if the smallest term is 1, 3 if the smallest term is 2, and 1 otherwise.
(End)
a(n) = A005374(n+1) - A005374(n) - 2*(A202340(n+1) - 2). - Alan Michael Gómez Calderón, Jul 19 2025

Extensions

Edited by N. J. A. Sloane, Oct 10 2007 and Aug 03 2014

A136496 Solution of the complementary equation b(n)=a(a(n))+n; this is sequence b; sequence a is A136495.

Original entry on oeis.org

2, 6, 8, 11, 15, 19, 21, 25, 27, 30, 34, 36, 39, 43, 47, 49, 52, 56, 60, 62, 66, 68, 71, 75, 79, 81, 85, 87, 90, 94, 96, 99, 103, 107, 109, 113, 115, 118, 122, 124, 127, 131, 135, 137, 140, 144, 148, 150, 154, 156, 159, 163, 165, 168, 172, 176, 178, 181, 185, 189
Offset: 1

Views

Author

Clark Kimberling, Jan 01 2008

Keywords

Comments

b = 1 + (column 1 of Z) = 1 + A020942. The pair (a,b) also satisfy the following complementary equations: b(n)=a(a(a(n)))+1; a(b(n))=a(n)+b(n); b(a(n))=a(n)+b(n)-1; (and others).
Position of the n-th occurrence of the digit 2 in A105083(n-1) for n>=1. - Jeffrey Shallit, Mar 08 2025

Examples

			b(1) = a(a(1))+1 = a(1)+1 = 1+1 = 2;
b(2) = a(a(2))+2 = a(3)+2 = 4+2 = 6;
b(3) = a(a(3))+3 = a(4)+3 = 5+3 = 8;
b(4) = a(a(4))+4 = a(5)+4 = 7+4 = 11.
		

References

  • Clark Kimberling and Peter J. C. Moses, Complementary equations and Zeckendorf arrays, in Applications of Fibonacci Numbers, vol.10, Proceedings of the Thirteenth International Conference on Fibonacci Numbers and Their Applications, William Webb, editor, Congressus Numerantium, Winnipeg, Manitoba 201 (2010) 161-178.

Crossrefs

Formula

Let Z = (3rd order Zeckendorf array) = A136189. Then a = ordered union of columns 1,3,4,6,7,9,10,12,13,... of Z, b = ordered union of columns 2,5,8,11,14,... of Z.
a(n) = A136495(n) + A005374(n-1) + n. - Alan Michael Gómez Calderón, Dec 23 2024
Showing 1-10 of 29 results. Next