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

A381110 a(n) is the maximum number of points from the set {(k, f(k)); k = 0..n} belonging to a straight line passing through the point (n, f(n)), where f(n) = A060143(n) = floor(n/phi) and phi is the golden ratio (sqrt(5)+1)/2.

Original entry on oeis.org

1, 2, 2, 2, 3, 3, 4, 3, 5, 3, 4, 4, 4, 5, 3, 5, 4, 4, 6, 4, 5, 5, 5, 6, 5, 6, 7, 6, 5, 6, 7, 6, 7, 5, 7, 8, 6, 8, 6, 7, 9, 6, 9, 7, 6, 10, 6, 7, 8, 7, 11, 7, 7, 9, 7, 12, 7, 8, 10, 8, 8, 8, 8, 11, 8, 9, 9, 9, 9, 8, 9, 10, 9, 10, 9, 10, 11, 8, 10, 10, 10, 11, 8
Offset: 0

Views

Author

Pontus von Brömssen, Feb 14 2025

Keywords

Comments

The sequence would remain the same if A060143 in the definition were replaced with A066096, i.e., if points (k, floor(k*phi)) were considered instead of (k, floor(k/phi)).

Crossrefs

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

A066096 a(n) = floor(n*phi), where phi = (1 + sqrt(5))/2.

Original entry on oeis.org

0, 1, 3, 4, 6, 8, 9, 11, 12, 14, 16, 17, 19, 21, 22, 24, 25, 27, 29, 30, 32, 33, 35, 37, 38, 40, 42, 43, 45, 46, 48, 50, 51, 53, 55, 56, 58, 59, 61, 63, 64, 66, 67, 69, 71, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, 92, 93, 95, 97, 98, 100, 101, 103, 105, 106
Offset: 0

Views

Author

Michele Dondi (bik.mido(AT)tiscalenet.it), Dec 30 2001

Keywords

Comments

a(n) is the smallest number different from a(i) and a(i)+i for i < n.
The losing positions in the game of Wythoff-Nim are precisely the pairs (a(n), a(n)+n).

Crossrefs

Programs

  • Magma
    [Floor((1+Sqrt(5))*n/2): n in [0..80]]; // G. C. Greubel, Sep 12 2023
    
  • Mathematica
    Floor[GoldenRatio*Range[0, 80]] (* G. C. Greubel, Sep 12 2023 *)
  • PARI
    a(n) = (n+sqrtint(5*n^2))\2;
    [a(n)|n<-[0..100]] \\ Simon Strandgaard, Jun 28 2022
    
  • SageMath
    [floor(golden_ratio*n) for n in range(81)] # G. C. Greubel, Sep 12 2023

Formula

For n >= 1, a(n) = A000201(n).
Duplicate values in A060143.
a(n) = 1 + A022342(n) = A000201(n).
a(n) = floor(n*phi), where phi = (1 + sqrt(5))/2. - Peter Munn, Jan 12 2018
a(n) = A026351(n) - 1. - Philippe Deléham, Jan 15 2023

Extensions

Name corrected by Peter Munn, Dec 06 2017
New name using a formula from Peter Munn by Peter Luschny, Jan 18 2023

A006336 a(n) = a(n-1) + a(n - 1 - number of even terms so far).

Original entry on oeis.org

1, 2, 3, 5, 8, 11, 16, 21, 29, 40, 51, 67, 88, 109, 138, 167, 207, 258, 309, 376, 443, 531, 640, 749, 887, 1054, 1221, 1428, 1635, 1893, 2202, 2511, 2887, 3330, 3773, 4304, 4835, 5475, 6224, 6973, 7860, 8747, 9801, 11022, 12243, 13671, 15306, 16941
Offset: 1

Views

Author

D. R. Hofstadter, Jul 15 1977

Keywords

Comments

From T. D. Noe, Jul 27 2007: (Start)
This is similar to A000123 and A005704, which both have a recursion a(n)=a(n-1)+a([n/k]), where k is 2 and 3, respectively. Those sequences count "partitions of k*n into powers of k". For the present sequence, k=phi. Does A006336(n) count the partitions of n*phi into powers of phi?
Answering my own question: If the recursion starts with a(0)=1, then I think we obtain "number of partitions of n*phi into powers of phi" (see A131882).
Here we need negative powers of phi also: letting p=phi and q=1/phi, we have
n=0: 0*p = {} for 1 partition,
n=1: 1*p = p = 1+q for 2 partitions,
n=2: 2*p = p+p = 1+p+q = 1+1+q+q = p^2+q for 4 partitions, etc.
So the present sequence, which starts with a(1)=1, counts 1/2 of the "number of partitions of n*phi into powers of phi". (End)

Crossrefs

"Number of even terms so far" is A060144(n+1).

Programs

  • Haskell
    a006336 n = a006336_list !! (n-1)
    a006336_list = 1 : h 2 1 0 where
      h n last evens = x : h (n + 1) x (evens + 1 - x `mod` 2) where
        x = last + a006336 (n - 1 - evens)
    -- Reinhard Zumkeller, May 18 2011
  • Maple
    # Maple code for first M terms of a(n) and A060144, from N. J. A. Sloane, Oct 25 2014
    M:=100;
    v[1]:=1; v[2]:=2; w[1]:=0; w[2]:=1;
    for n from 3 to M do
       v[n]:=v[n-1]+v[n-1-w[n-1]];
    if v[n] mod 2 = 0 then w[n]:=w[n-1]+1 else w[n]:=w[n-1]; fi; od:
    [seq(v[n],n=1..M)]; # A006336
    [seq(w[n],n=1..M)]; # A060144 shifted
  • Mathematica
    a[n_Integer] := a[n] = Block[{c, k}, c = 0; k = 1; While[k < n, If[ EvenQ[ a[k] ], c++ ]; k++ ]; Return[a[n - 1] + a[n - 1 - c] ] ]; a[1] = 1; a[2] = 2; Table[ a[n], {n, 0, 60} ]
  • PARI
    A006336(N=99) = local(a=vector(N,i,1), e=0); for(n=2,#a,e+=0==(a[n]=a[n-1]+a[n-1-e])%2);a \\ M. F. Hasler, Jul 23 2007
    

Formula

It seems that A006336 can be generated by a rule using the golden ratio phi: a(n) = a(n-1) + a([n/Phi]) for n>1 with a(1)=1 where phi = (sqrt(5)+1)/2, I.e. the number of even terms up to position n-1 equals n-1 - [n/Phi] for n>1 where Phi = (sqrt(5)+1)/2. (This is true - see the Alekseyev link.) - Paul D. Hanna, Jul 22 2007
a(n) = a(n-1)+a(A060143(n)) for n>1; subsequence of A134409; A134408 and A134409 give first and second differences; A001950(n)=Min(m:A134409(m)=a(n)). - Reinhard Zumkeller, Oct 24 2007

Extensions

More terms from Robert G. Wilson v, Mar 07 2001
Entry revised by N. J. A. Sloane, Oct 25 2014

A019444 a_1, a_2, ..., is a permutation of the positive integers such that the average of each initial segment is an integer, using the greedy algorithm to define a_n.

Original entry on oeis.org

1, 3, 2, 6, 8, 4, 11, 5, 14, 16, 7, 19, 21, 9, 24, 10, 27, 29, 12, 32, 13, 35, 37, 15, 40, 42, 17, 45, 18, 48, 50, 20, 53, 55, 22, 58, 23, 61, 63, 25, 66, 26, 69, 71, 28, 74, 76, 30, 79, 31, 82, 84, 33, 87, 34, 90, 92, 36, 95, 97, 38, 100, 39, 103, 105, 41, 108, 110, 43, 113
Offset: 1

Views

Author

R. K. Guy and Tom Halverson (halverson(AT)macalester.edu)

Keywords

Comments

Self-inverse when considered as a permutation or function, i.e., a(a(n)) = n. - Howard A. Landman, Sep 25 2001
That each initial segment has an integer average is trivially equivalent to the sum of the first n elements always being divisible by n. - Franklin T. Adams-Watters, Jul 07 2014
Also, a lexicographically minimal sequence of distinct positive integers such that all values of a(n)-n are also distinct. - Ivan Neretin, Apr 18 2015
Comments from N. J. A. Sloane, Mar 29 2025 (Start):
Let d(n) = number of 1 <= i <= n such that a(i) < i. The d(i) sequence begins 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, ..., and appears to be A060144 without its initial term.
Let r(n) = 1 if a(n) < a(n+1), otherwise 0, and let f(n) = 1 if a(n) > a(n+1), otherwise 0. Then R = partial sums of r(n) and F = partial sums of f(n) count the rises and falls, respectively, in the present sequence. It appears that R and F are essentially A060143 and A060144 (again).
If a(n) is the k-th term in a monotonically strictly increasing rum of terms, set R(n) = k. It appears that the sequence R(n), n>=1, is essentially A270788.
For other sequences derived from the present one, see A382162, A382168, and A382169.
(End)

References

  • Muharem Avdispahić and Faruk Zejnulahi, An integer sequence with a divisibility property, Fibonacci Quarterly, Vol. 58:4 (2020), 321-333.

Crossrefs

Programs

  • Mathematica
    a[1]=1; a[n_] := a[n]=Module[{s, v}, s=a/@Range[n-1]; For[v=Mod[ -Plus@@s, n], v<1||MemberQ[s, v], v+=n, Null]; v]
    lst = {1}; f[s_List] := Block[{k = 1, len = 1 + Length@ lst, t = Plus @@ lst}, While[ MemberQ[s, k] || Mod[k + t, len] != 0, k++ ]; AppendTo[lst, k]]; Nest[f, lst, 69] (* Robert G. Wilson v, May 17 2010 *)
    Fold[Append[#1, #2 Ceiling[#2/GoldenRatio] - Total[#1]] &, {1}, Range[2, 70]] (* Birkas Gyorgy, May 25 2012 *)
  • PARI
    al(n)=local(v,s,fnd);v=vector(n);v[1]=s=1;for(k=2,n,fnd=0;for(i=1,k-1,if(v[i]==s,fnd=1;break));v[k]=if(fnd,s+k,s);s+=fnd);v \\ Franklin T. Adams-Watters, May 20 2010
    
  • PARI
    A019444_upto(N, c=0, A=Vec(1, N))={for(n=2, N, A[n]||(#AM. F. Hasler, Nov 27 2019

Formula

a(n) = A002251(n-1) + 1. (Corrected by M. F. Hasler, Sep 17 2014)
Let s(n) = (1/n)*Sum_{k=1..n} a(k) = A019446(n). Then if s(n-1) does not occur in a(1),...,a(n-1), a(n) = s(n) = s(n-1); otherwise, a(n) = s(n-1) + n and s(n) = s(n-1) + 1. - Franklin T. Adams-Watters, May 20 2010
Lim_{n->infinity} max(n,a(n))/min(n,a(n)) = phi = A001622. - Stanislav Sykora, Jun 12 2017

A057363 a(n) = floor(8*n/13).

Original entry on oeis.org

0, 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, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 41, 42, 43, 43, 44, 44
Offset: 0

Views

Author

Keywords

Comments

The cyclic pattern (and numerator of the gf) is computed using Euclid's algorithm for GCD.

References

  • N. Dershowitz and E. M. Reingold, Calendrical Calculations, Cambridge University Press, 1997.
  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, NY, 1994.

Crossrefs

Note that 20 appears twice. Different from A005206, A060143.

Programs

  • Magma
    [Floor(8*n/13): n in [0..50]]' // G. C. Greubel, Nov 02 2017
  • Mathematica
    Table[Floor[8*n/13], {n, 0, 50}] (* G. C. Greubel, Nov 02 2017 *)
    LinearRecurrence[{1,0,0,0,0,0,0,0,0,0,0,0,1,-1},{0,0,1,1,2,3,3,4,4,5,6,6,7,8},80] (* Harvey P. Dale, Jul 21 2020 *)
  • PARI
    a(n)=8*n\13 \\ Charles R Greathouse IV, Sep 02 2015
    

Formula

a(n) = a(n-1) + a(n-13) - a(n-14).
G.f.: x^2*(1+x)*(x^2 - x + 1)*(x^8 + x^7 + x^2 + 1)/( (x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1)*(x-1)^2 ). [Numerator corrected Feb 20 2011]

A183136 a(n) = [1/r]+[2/r]+...+[n/r], where r = golden ratio = (1+sqrt(5))/2 and []=floor.

Original entry on oeis.org

0, 1, 2, 4, 7, 10, 14, 18, 23, 29, 35, 42, 50, 58, 67, 76, 86, 97, 108, 120, 132, 145, 159, 173, 188, 204, 220, 237, 254, 272, 291, 310, 330, 351, 372, 394, 416, 439, 463, 487, 512, 537, 563, 590, 617, 645, 674, 703, 733, 763, 794, 826, 858
Offset: 1

Views

Author

Clark Kimberling, Dec 26 2010

Keywords

Comments

a(n) + A183137(n) = A000217(n) (the triangular numbers).

Examples

			The terms [k/r] are given by A060143 (and A005206): 0,1,1,2,3,3,4,4,5,6,6,7,8,8,...
		

Crossrefs

Programs

  • Mathematica
    Accumulate[Floor[Range[100]/GoldenRatio]] (* Paolo Xausa, Jun 20 2025 *)
  • PARI
    default(realprecision,100); r=(1+sqrt(5))/2; for(n=1,99, print1(sum(k=1,n,floor(k/r)), ", "))
    
  • Python
    from math import isqrt
    def A183136(n): return sum(isqrt(5*i**2)-i>>1 for i in range(1,n+1)) # Chai Wah Wu, Jun 20 2025

Formula

a(n) = [1/r]+[2/r]+...+[n/r], where r = golden ratio = (1+sqrt(5))/2 and []=floor.

A356327 Replace 2^k in binary expansion of n with A039834(1+k).

Original entry on oeis.org

0, 1, -1, 0, 2, 3, 1, 2, -3, -2, -4, -3, -1, 0, -2, -1, 5, 6, 4, 5, 7, 8, 6, 7, 2, 3, 1, 2, 4, 5, 3, 4, -8, -7, -9, -8, -6, -5, -7, -6, -11, -10, -12, -11, -9, -8, -10, -9, -3, -2, -4, -3, -1, 0, -2, -1, -6, -5, -7, -6, -4, -3, -5, -4, 13, 14, 12, 13, 15, 16
Offset: 0

Views

Author

Rémy Sigrist, Aug 03 2022

Keywords

Comments

This sequence has similarities with A022290, and is related to negaFibonacci representations.

Examples

			For n = 13:
- 13 = 2^3 + 2^2 + 2^0,
- so a(13) = A039834(4) + A039834(3) + A039834(1) = -3 + 2 + 1 = 0.
		

Crossrefs

Programs

  • Mathematica
    Table[Reverse[#].Fibonacci[-Range[Length[#]]] &@ IntegerDigits[n, 2], {n, 0, 69}] (* Rémy Sigrist, Aug 05 2022 *)
  • PARI
    a(n) = { my (v=0, k); while (n, n-=2^k=valuation(n, 2); v+=fibonacci(-1-k)); return (v) }
    
  • Python
    from sympy import fibonacci
    def A356327(n): return sum(fibonacci(-a)*int(b) for a, b in enumerate(bin(n)[:1:-1],start=1)) # Chai Wah Wu, Aug 31 2022

Formula

a(n) = Sum_{k>=0} A030308(n,k)*A039834(1+k).
a(A215024(n)) = n.
a(A215025(n)) = -n.
a(A003714(n)) = A309076(n).
Empirically:
- a(n) = 0 iff n = 0 or n belongs to A072197,
- a(n) = 1 iff n belongs to A020989,
- a(2*A215024(n)) = -A000201(n) for n > 0,
- a(3*A215024(n)) = -A060143(n),
- a(floor(A215024(n)/2)) = -A060143(n),
- a(4*A215024(n)) = A001950(n) for n > 0,
- a(floor(A215024(n)/4)) = A189663(n) for n > 0,
- a(2*A215025(n)) = A026351(n),
- a(3*A215025(n)) = A019446(n) for n > 0,
- a(floor(A215025(n)/2)) = A019446(n) for n > 0,
- a(4*A215025(n)) = -A004957(n),
- a(floor(A215025(n)/4)) = -A060144(n+1) for n >= 0.

A345253 Maximal Fibonacci tree: Arrangement of the positive integers as labels of a complete binary tree.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 13, 11, 14, 16, 21, 12, 15, 17, 22, 18, 23, 26, 34, 19, 24, 27, 35, 29, 37, 42, 55, 20, 25, 28, 36, 30, 38, 43, 56, 31, 39, 44, 57, 47, 60, 68, 89, 32, 40, 45, 58, 48, 61, 69, 90, 50, 63, 71, 92, 76, 97, 110, 144, 33, 41, 46, 59, 49
Offset: 1

Views

Author

J. Parker Shectman, Jun 12 2021

Keywords

Comments

Every positive integer occurs exactly once, so that, as a sequence, a(n) is a permutation of the positive integers.
Descending from the root node 1, generate tree by outer composition of L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1), respectively, according to left or right branching, where F(n) = A000045(n) are the Fibonacci numbers and Finv(n) = A130233(n) is the 'lower' Fibonacci inverse. This produces each number by maximal Fibonacci expansion (cf. example below of Method 2, entry A343152, and links).
(Level of tree): The number of terms in this expansion of n is the level of the tree on which n appears, A112310(n-1) + 1 = A200648(n+1). The number of terms in the expansion of a(n) is floor(log_2(n)) + 1 = A113473(n) = A070939(n) = A029837(n+1).
"Maximal Fibonacci expansion" maximizes the sum of coefficients over all Fibonacci numbers (of positive index), allowing both F(1) = 1 and F(2) = 1. Thus, it is just an expansion and not a representation (like "greedy" and "lazy"), as it "breaks the rule" by using two bits that correspond to elements of equal value, rather than using distinct basis elements (link). This reveals connections to the cf. sequences: Binary strings that emerge in lexicographic order from "maximal Fibonacci gaps" (example), binary trees of the positive integers, and I-D arrays "harvested" from the trees. To define the expansion uniquely, always include F(1), so that the expansion of positive integer n equals F(1) for n = 1 and F(1) prepended to the lazy Fibonacci representation of n-1 for n > 1. Hence, a(1) = 1, and for n > 1, a(n) = A095903(n-1) + 1. The "redundant" expansion arranges the positive integers in the single binary tree {T(n,k)}, rather than the two trees at A255773 and A255774 that result from representation (see link).
(Left-to-right order in tree): Each F(t)-sized block (F(t+1), ..., F(t+2) - 1) of successive positive integers ("Fibonacci cohort" t) appears in right-to-left order in the tree as reordered in A343152, where elements of each cohort appear consecutively (see link).
Descending from the root node 1, generate tree by the inner composition of A026351 and A026352, that is, one plus the sequences of lower and upper Wythoff numbers, A000201 and A001950, respectively, according to left or right branching (see example below of Method 1 and links).
Generate tree from (one plus) the number of (initial) zeros on the positive integers for the outer composition of sequences, A060143 and A060144, respectively, according to left or right branching descending from the identity (c.f example below of Method 3 and links).
The lower Wythoff numbers, A000201, appear exclusively in the 1st, 3rd, 5th, ... right clades of the tree, while the upper Wythoff numbers A001950, appear exclusively in the 2nd, 4th, 6th, ... right clades of the tree. Here, the k-th right clade comprises the nodes at positions 2^(k+1) and 2^k + 1, together with all descendants of the latter (link).
(Duality with tree A232560, and related arrays): Consider the labeled binary trees a(n) = A232560(A059893(n)) and A232560(n) = a(A059893(n)). Labels along maximal straight paths that always branch left in a(n) give rows of array A345252, while labels along maximal straight paths that always branch left in A232560 give rows of array A083047.
Sorting the labels from each successive right clade of the binary tree a(n) gives the successive columns of A083047, while sorting labels from each successive right clade of A232560 gives each successive column of A345252. This makes the trees a(n) and A232560 "blade-duals," blade being a contraction of branch-clade (see entry for A345254 and link). A200648(n)+1 gives the level of the tree on which elements of array first-columns A345252(n,1) and A083047(n,1) appear.
(Palindromes and coincidence of elements): Trees a(n) and A232560 coincide when the sequence of left and right branching is a palindrome: a(A329395(n)) = A232560(A329395(n)). As Kimberling notes (cf. A059893), this happens at fixed points of A059893(n) or, equivalently, at n for which A081242(n) is a palindrome.
The inverse permutation of a(n) as a sequence can be read from a "tetrangle" or "irregular triangle" tableau with F(t) (Fibonacci number) entries on each row t, for t = 1, 2, 3, ..., in which an entry on row t is 2*x the entry x immediately above it on row t-1, if such exists, or otherwise 2*x + 1 the entry x in the corresponding position on row t-2 (thus generating new rows as in A243571 but without sorting the numbers into increasing order, linked reference):
1,
2,
3, 4,
5, 6, 8,
7, 9, 10, 12, 16,
11, 13, 17, 14, 18, 20, 24, 32,
...
With the right-justified tableau substituted by a left-justified tableau, the same procedure yields the inverse permutation for the "minimal Fibonacci tree," A048680(A059893(n)), the "cohort-dual" tree of a(n), where "cohort" t is the F(t)-sized block of successive entries in the tableau (see entry for A345252, linked reference).
(Coincidence of elements): a(A020988(n)) = A048680(A059893(A020988(n))) = A099919(n) and a(A020989(n)) = A048680(A059893(A020989(n))) = A049651(n). Collectively, a(A061547(n)) = A048680(A059893(A061547(n))) = union(A049651(n), A099919(n)).
With two types of duality, the tree forms a quartet of binary-tree arrangements of the positive integers, together with its blade dual A232560, its cohort dual A048680(A059893), and blade dual A048680 of the latter.
Order in the tree is "memory-less": Let a(n) and a(m) label nodes at positions n and m, respectively. Let d1 and d2 be two descending paths, i.e., sequences branching left or right from a starting node. (Nodal positions for the left and right children of the node at position p are given by 2*p and 2*p + 1, resp., and d1 and d2 are compositions of these.) Then a(d1(n)) < a(d2(n)) if and only if a(d1(m)) < a(d2(m)) (linked reference).

Examples

			As a complete binary tree:
                    1
           /                 \
          2                   3
      /       \          /        \
     4         5        6          8
    / \       / \      / \        / \
   7    9    10   13   11   14   16   21
  / \  / \  /  \ /  \ /  \ /  \ /  \ /  \
  ...
By maximal Fibonacci expansion:
                                        F(1)
                      /                                       \
                F(1) + F(2)                               F(1) + F(3)
           /                    \                    /                  \
  F(1) + F(2) + F(3)   F(1) + F(2) + F(4)   F(1) + F(3) + F(4)   F(1) + F(3) + F(5)
  ...
"Fibonacci gaps," or differences between successive indices in maximal Fibonacci expansion above, are A007931(n-1) for n > 1 (see link):
                   *
          /                  \
         1                    2
     /       \           /        \
    11        12        21        22
   /  \      /  \      /  \      /  \
  111  112  121  122  211  212  221  222
  / \  / \  / \  / \  / \  / \  / \  / \
  ...
In examples of the three methods below:
Branch left-right-right down the tree to arrive at nodal position n = 2*(2*(2*1) + 1) + 1 = 11;
Branch right-left-left down the tree to arrive at nodal position n = 2*(2*(2*1 + 1)) = 12.
Tree by inner composition of (one plus) the lower and upper Wythoff sequences, A000201 and A001950 (Method 1):
a(11) = A000201(A001950(A001950(1) + 1) + 1) + 1 = 13.
a(12) = A001950(A000201(A000201(1) + 1) + 1) + 1 = 11.
Tree by (outer) composition of branching functions L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1), where F(n) = A000045(n) and Finv(n) = A130233(n) (Method 2):
a(11) = R(R(L(1))) = 13.
a(12) = L(R(R(1))) = 11.
Tree by outer composition of A060143 and A060144 (Wythoff inverse sequences) (Method 3):
a(11) = 13, position of first nonzero in A060144(A060144(A060143(m))) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., for m = 1, 2, 3, ....
a(12) = 11, position of first nonzero in A060143(A060143(A060144(m))) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., for m = 1, 2, 3, ....
		

Crossrefs

Programs

  • Mathematica
    (* For binary tree implementations, see supporting file under LINKS *)
    a[n_] := (x = 0; y = 0; BDn = Reverse[IntegerDigits[n, 2]]; imax = Length[BDn] - 1; For[i = 0, i <= imax, i++, {x, y} = {y + 1, x + y}; If[BDn[[i + 1]] == 1, {x, y} = {y, x + y}]]; y);
    (* Adapted from PARI code of Kevin Ryde *)
  • PARI
    a(n) = my(x=0,y=0); for(i=0,logint(n,2), [x,y]=[y+1,x+y]; if(bittest(n,i), [x,y]=[y,x+y])); y; \\ Kevin Ryde, Jun 19 2021

Formula

a(1) = 1 and for n > 1, a(n) = A095903(n-1) + 1.
a(n) = A232560(A059893(n)).

A076539 Numerators a(n) of fractions slowly converging to Pi: let a(1) = 0, b(n) = n - a(n); if (a(n) + 1) / b(n) < Pi, then a(n+1) = a(n) + 1, otherwise a(n+1) = a(n).

Original entry on oeis.org

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

Views

Author

Robert A. Stump (bee_ess107(AT)msn.com), Oct 18 2002

Keywords

Comments

a(n) + b(n) = n and as n -> +infinity, a(n)/b(n) converges to Pi. For all n, a(n)/b(n) < Pi.

Examples

			a(7)= 5 so b(7) = 7 - 5 = 2.
a(8) = 6 because (a(7) + 1)/b(7) = 6/2 which is < Pi. So b(8) = 8 - 6 = 2.
a(9) = 6 because (a(8) + 1)/b(8) = 7/2 which is not < Pi.
		

Crossrefs

Partial sums of A144609.

Programs

Formula

a(1) = 0, b(n) = n - a(n), if (a(n) + 1)/b(n) < Pi, then a(n+1) = a(n) + 1, otherwise a(n+1) = a(n).
a(n) = floor(n*Pi/(Pi+1)). - Vladeta Jovovic, Oct 04 2003
Showing 1-10 of 15 results. Next