login
Search: a026351 -id:a026351
     Sort: relevance | references | number | modified | created      Format: long | short | data
a(n) = [nr]-[nr-kr]-[kr], where r=(1+sqrt(5))/2, k=4, [ ]=floor.
+10
80
0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0
OFFSET
1
COMMENTS
Suppose r is a positive irrational number and k is a positive integer, so that the sequence given by a(n)=[nr]-[nr-kr]-[kr] consists of zeros and ones. Let b(n)=(position of n-th 0) and c(n)=(position of n-th 1), so that b and c are a complementary pair of sequences.
Examples of a, b, c using r=(1+sqrt(5))/2:
k=1: a=A096270, b=A026352, c=A026351
k=2: a=A188009, b=A188010, c=A101866
k=3: a=A188011, b=A188012, c=A188013
k=4: a=A188014, b=A188015, c=A188016
Example using r=sqrt(2):
k=1: a=A188037, b=A083088, c=A080754.
Returning to arbitrary positive irrational r, let s(n)=[nr]-[nr-r]-[r], this being a(n) when k=1. For k>=2, the sequence a(n)=[nr]-[nr-kr]-[kr] is a shifted sum of shifted copies of s:
a(n)=s(n)+s(n-1)+...+s(n-k+1)-(constant). This sum matches the sum s(n)+s(n+1)+...+s(n+k-1)-(constant) at A187950.
Ratio of number of zeros to number of ones tends to sqrt(5)/2=1.118. Any (simple) proof? [Zak Seidov, Feb 14 2012] According to Charles R Greathouse IV (see formula), a(n)=1 if the fractional part of nr is less than w(1)=4r-6,and 0 otherwise, where r=(1+sqrt(5))/2. It means that probability of ones and zeros is, respectively, w(1) and w(0)=1-w(1). In the long run, number of ones and zeros is, respectively, w(1)*n and w(0)*n and, finally, the ratio of number of zeros to number of ones tends to w(0)/w(1)=sqrt(5)/2, qed. [Zak Seidov, Feb 17 2012]
Essentially the same as A187950. - Michel Dekking, Sep 17 2016
LINKS
FORMULA
a(n) = [nr]-[nr-4r]-[4r], where r=(1+sqrt(5))/2.
a(n) = 1 if the fractional part of nr is less than 4r - 6, and 0 otherwise. [Charles R Greathouse IV, Feb 14 2012]
a(n+4) = A187950(n) for n>=1. - Michel Dekking, Sep 17 2016
EXAMPLE
We get a=A188014, b=A188015, c=A188016 when
r=(1+sqrt(5))/2 and k=4:
a......0..1..0..0..1..0..1..0..0..1..0..1..1...
b......1..3..4..6..8..9..11..14.. (positions of 0 in a)
c......2..5..7..10..12..13..15... (positions of 1 in a).
As noted in Comments, a(n)=[nr]-[nr-4r]-[4r] is also obtained in another way: by adding right shifts of the infinite Fibonacci word s=A096270 (after left-extending it) and then down shifting:
s(n)......0..1..0..1..1..0..1..0..1..1..0..1..1..
s(n-1)....1..0..1..0..1..1..0..1..0..1..1..0..1..
s(n-2)....1..1..0..1..0..1..1..0..1..0..1..1..0..
s(n-3)....0..1..1..0..1..0..1..1..0..1..0..1..1..
sum.......2..3..2..2..3..2..3..2..2..3..2..3..3..
sum-2.....0..1..0..0..1..0..1..0..0..1..0..1..1..
(Right shifts s(n-k) of the infinite Fibonacci word are obtained from s(n)=[nr]-[nr-nk]-[nk] rather than the morphism 0->01, 1->011 at A096270. For an analogous example using left shifts, see A187950.)
MATHEMATICA
r=(1+5^(1/2))/2; k=4;
t=Table[Floor[n*r]-Floor[(n-k)*r]-Floor[k*r], {n, 1, 220}] (*A188014*)
Flatten[Position[t, 0]] (*A188015*)
Flatten[Position[t, 1]] (*A188016*)
PROG
(PARI) a(n)=my(r=(1+sqrt(5))/2); n*r-n*r\1<4*r-6 \\ Charles R Greathouse IV, Feb 14 2012
(Python)
from __future__ import division
from gmpy2 import isqrt
def A188014(n):
return int((isqrt(5*n**2)+n)//2 -(isqrt(5*(n-4)**2)+n)//2 - 4) if n > 3 else 1-(n % 2) # Chai Wah Wu, Oct 07 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Mar 19 2011
STATUS
approved
Sequence (or tree) generated by these rules: 1 is in S, and if x is in S, then x + 1 and 2*x are in S, and duplicates are deleted as they occur.
+10
40
1, 2, 3, 4, 6, 5, 8, 7, 12, 10, 9, 16, 14, 13, 24, 11, 20, 18, 17, 32, 15, 28, 26, 25, 48, 22, 21, 40, 19, 36, 34, 33, 64, 30, 29, 56, 27, 52, 50, 49, 96, 23, 44, 42, 41, 80, 38, 37, 72, 35, 68, 66, 65, 128, 31, 60, 58, 57, 112, 54, 53, 104, 51, 100, 98, 97
OFFSET
1,2
COMMENTS
Let S be the set of numbers defined by these rules: 1 is in S, and if x is in S, then x + 1 and 2*x are in S. Then S is the set of all positive integers, which arise in generations. Deleting duplicates as they occur, the generations are given by g(1) = (1), g(2) = (2), g(3) = (3,4), g(4) = (6,5,8), g(5) = (7,12,10,9,16), etc. Concatenating these gives A232559, a permutation of the positive integers. The number of numbers in g(n) is A000045(n), the n-th Fibonacci number. It is helpful to show the results as a tree with the terms of S as nodes and edges from x to x + 1 if x + 1 has not already occurred, and an edge from x to 2*x if 2*x has not already occurred. The positions of the odd numbers are given by A026352, and of the evens, by A026351.
The previously mentioned tree is an example of a fractal tree; that is, an infinite rooted tree T such that every complete subtree of T contains a subtree isomorphic to T. - Clark Kimberling, Jun 11 2016
The similar sequence S', generated by these rules: 0 is in S', and if x is in S', then 2*x and x+1 are in S', and duplicates are deleted as they occur, appears to equal A048679. - Rémy Sigrist, Aug 05 2017
From Katherine E. Stange and Glen Whitney, Oct 09 2021: (Start)
The beginning of this tree is
1
|
2
/ \
3..../ \......4
| / \
6 5.../ \...8
/ \ | / \
7/ \12 10 9/ \16
This tree contains every positive integer, and one can show that the path from 1 to the integer n is exactly the sequence of intermediate values observed during the Double-And-Add Algorithm AKA Chandra Sutra Method (namely, the algorithm which begins with m = 0, reads the binary representation of n from left to right, and, for each digit 0 read, doubles m, and for each digit 1 read, doubles m and then adds 1 to m; when the algorithm terminates, m = n).
As such, the path between 1 and n is a function of the binary expansion of n. The elements of the k-th row of the tree (generation g(k)) are all those elements whose binary expansion has k_1 digits and Hamming weight k_2, for some k_1 and k_2 such that k_1 + k_2 = k + 1.
The depth at which integer n appears in this tree is given by A014701(n) = A056792(n)-1. For example, the depth of 1 is 0, the depth of 2 is 1, and the depths of 3 and 4 are both 2. (End)
Definition need not invoke deletion: Tree is rooted at 1, all even nodes have x+1 as a child, all nodes have 2*x as a child, and any x+1 child precedes its sibling. - Robert Munafo, May 08 2024
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from Clark Kimberling)
Dimitri Zucker, I Found a Simple Pattern That Encodes Different Bases, YouTube video, 2024. (Adds 0 above the root of the tree, and shows how to reconstruct the tree backwards from child nodes)
FORMULA
Conjecture: a(n) = A059894(A348366(n)) for n > 0. - Mikhail Kurkov, Jun 14 2022
EXAMPLE
Each x begets x + 1 and 2*x, but if either has already occurred it is deleted. Thus, 1 begets 2, which begets (3,4); from which 3 begets only 6, and 4 begets (5,8).
MAPLE
a:= proc() local l, s; l, s:= [1], {1}:
proc(n) option remember; local i, r; r:= l[1];
l:= subsop(1=NULL, l);
for i in [1+r, r+r] do if not i in s then
l, s:=[l[], i], s union {i} fi
od; r
end
end():
seq(a(n), n=1..100); # Alois P. Heinz, Aug 06 2017
MATHEMATICA
z = 12; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1]]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]] (* this sequence *)
Table[Length[g1[n]], {n, 1, z}] (* Fibonacci numbers *)
t1 = Flatten[Table[Position[t, n], {n, 1, 200}]] (* A232560 *)
PROG
(Python)
def aupton(terms):
alst, S, expand = [1, 2], {1, 2}, [2]
while len(alst) < terms:
x = expand.pop(0)
new_elts = [y for y in [x+1, 2*x] if y not in S]
alst.extend(new_elts); expand.extend(new_elts); S.update(new_elts)
return alst[:terms]
print(aupton(66)) # Michael S. Branicky, Sep 14 2021
CROSSREFS
Cf. A232560 (inverse permutation), A232561, A232563, A226080, A226130.
Cf. A243571 (rows sorted).
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Nov 26 2013
STATUS
approved
a(n) = floor(n*phi), where phi = (1 + sqrt(5))/2.
+10
27
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,3
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).
LINKS
FORMULA
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
MATHEMATICA
Floor[GoldenRatio*Range[0, 80]] (* G. C. Greubel, Sep 12 2023 *)
PROG
(PARI) a(n) = (n+sqrtint(5*n^2))\2;
[a(n)|n<-[0..100]] \\ Simon Strandgaard, Jun 28 2022
(Magma) [Floor((1+Sqrt(5))*n/2): n in [0..80]]; // G. C. Greubel, Sep 12 2023
(SageMath) [floor(golden_ratio*n) for n in range(81)] # G. C. Greubel, Sep 12 2023
KEYWORD
nonn,easy
AUTHOR
Michele Dondi (bik.mido(AT)tiscalenet.it), Dec 30 2001
EXTENSIONS
Name corrected by Peter Munn, Dec 06 2017
New name using a formula from Peter Munn by Peter Luschny, Jan 18 2023
STATUS
approved
a(n) = floor(n*tau) + n + 1 where tau is the golden ratio A001622.
+10
20
1, 3, 6, 8, 11, 14, 16, 19, 21, 24, 27, 29, 32, 35, 37, 40, 42, 45, 48, 50, 53, 55, 58, 61, 63, 66, 69, 71, 74, 76, 79, 82, 84, 87, 90, 92, 95, 97, 100, 103, 105, 108, 110, 113, 116, 118, 121, 124, 126, 129, 131, 134, 137, 139, 142, 144
OFFSET
0,2
COMMENTS
a(n) = greatest k such that s(k) = n+1, where s = A026350.
Indices at which blocks (0;1) occur in infinite Fibonacci word; i.e., n such that A005614(n)=0 and A005614(n+1)=1. - Benoit Cloitre, Nov 15 2003
Except for the first term, these are the numbers whose lazy Fibonacci representation (see A095791) includes both 1 and 2; thus this sequence is a subsequence of the lower Wythoff sequence, A000201. - Clark Kimberling, Jun 10 2004 [A-number typo corrected by Nathan Fox, May 03 2014]
a(n) = n-th number k whose lazy Fibonacci representation (as in A095791) has more summands than that of k-1. - Clark Kimberling, Jun 12 2004
a(n) = position of n-th 0 in A096270. - Clark Kimberling, Apr 22 2011
Maximum number of chips in a pile created at each step in the game described by Roland Schroeder in his comment at A000201. (From Allan C. Wechsler via Seqfan.)
LINKS
Eric Friedman, Scott M. Garrabrant, Ilona K. Phipps-Morgan, A. S. Landsberg and Urban Larsson, Geometric analysis of a generalized Wythoff game, in Games of no Chance 5, MSRI publ. Cambridge University Press, 2019.
U. Larsson and N. Fox, An Aperiodic Subtraction Game of Nim-Dimension Two, Journal of Integer Sequences, 2015, Vol. 18, #15.7.4.
Ali Sada, Should A000201 and A026352 be cross-referenced?, Seqfan thread, Jun 2023.
MATHEMATICA
Table[Floor[GoldenRatio*n]+n+1, {n, 0, 60}] (* Harvey P. Dale, Aug 24 2021 *)
PROG
(PARI) a(n) = floor(n*(sqrt(5)+1)/2) + n + 1; \\ Michel Marcus, Sep 15 2016
(Python)
from math import isqrt
def A026352(n): return (n+isqrt(5*n**2)>>1)+n+1 # Chai Wah Wu, Aug 25 2022
CROSSREFS
Essentially same as A004957.
Subsequence of A000201.
Complement of A026351.
KEYWORD
nonn
AUTHOR
Clark Kimberling, Dec 11 1999
STATUS
approved
Ordered set S defined by these rules: 0 is in S and if x is in S then 2x+1 and 4x are in S.
+10
20
0, 1, 3, 4, 7, 9, 12, 15, 16, 19, 25, 28, 31, 33, 36, 39, 48, 51, 57, 60, 63, 64, 67, 73, 76, 79, 97, 100, 103, 112, 115, 121, 124, 127, 129, 132, 135, 144, 147, 153, 156, 159, 192, 195, 201, 204, 207, 225, 228, 231, 240, 243, 249, 252, 255, 256, 259, 265, 268, 271
OFFSET
0,3
COMMENTS
After expelling 0 and 1, the numbers 4x occupy same positions in S that 1 occupies in the infinite Fibonacci word (A003849).
a(A026351(n)) = A219608(n); a(A004957(n)) = 4 * a(n). - Reinhard Zumkeller, Nov 26 2012
Apart from the initial term, this lists the indices of the 1's in A086747. - N. J. A. Sloane, Dec 05 2019
From Gus Wiseman, Jun 10 2020: (Start)
Numbers k such that the k-th composition in standard order has all odd parts, or numbers k such that A124758(k) is odd. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. For example, the sequence of all compositions into odd parts begins:
0: () 57: (1,1,3,1) 135: (5,1,1,1)
1: (1) 60: (1,1,1,3) 144: (3,5)
3: (1,1) 63: (1,1,1,1,1,1) 147: (3,3,1,1)
4: (3) 64: (7) 153: (3,1,3,1)
7: (1,1,1) 67: (5,1,1) 156: (3,1,1,3)
9: (3,1) 73: (3,3,1) 159: (3,1,1,1,1,1)
12: (1,3) 76: (3,1,3) 192: (1,7)
15: (1,1,1,1) 79: (3,1,1,1,1) 195: (1,5,1,1)
16: (5) 97: (1,5,1) 201: (1,3,3,1)
19: (3,1,1) 100: (1,3,3) 204: (1,3,1,3)
25: (1,3,1) 103: (1,3,1,1,1) 207: (1,3,1,1,1,1)
28: (1,1,3) 112: (1,1,5) 225: (1,1,5,1)
31: (1,1,1,1,1) 115: (1,1,3,1,1) 228: (1,1,3,3)
33: (5,1) 121: (1,1,1,3,1) 231: (1,1,3,1,1,1)
36: (3,3) 124: (1,1,1,1,3) 240: (1,1,1,5)
39: (3,1,1,1) 127: (1,1,1,1,1,1,1) 243: (1,1,1,3,1,1)
48: (1,5) 129: (7,1) 249: (1,1,1,1,3,1)
51: (1,3,1,1) 132: (5,3) 252: (1,1,1,1,1,3)
(End)
Numbers whose binary representation has the property that every run of consecutive 0's has even length. - Harry Richman, Jan 31 2024
LINKS
Clark Kimberling, A Self-Generating Set and the Golden Mean, J. Integer Sequences, 3 (2000), #00.2.8.
Clark Kimberling, Fusion, Fission, and Factors, Fib. Q., 52 (2014), 195-202.
Lukasz Merta, Composition inverses of the variations of the Baum-Sweet sequence, arXiv:1803.00292 [math.NT], 2018. See l(n) p. 5.
EXAMPLE
From Harry Richman, Jan 31 2024: (Start)
In the following, dots are used for zeros in the binary representation:
n binary(a(n)) a(n)
0: ....... 0
1: ......1 1
2: .....11 3
3: ....1.. 4
4: ....111 7
5: ...1..1 9
6: ...11.. 12
7: ...1111 15
8: ..1.... 16
9: ..1..11 19
10: ..11..1 25
11: ..111.. 28
12: ..11111 31
13: .1....1 33
14: .1..1.. 36
15: .1..111 39
16: .11.... 48
17: .11..11 51
18: .111..1 57
19: .1111.. 60
20: .111111 63
21: 1...... 64
22: 1....11 67
(End)
MATHEMATICA
Take[Nest[Union[Flatten[# /. {{i_Integer -> i}, {i_Integer -> 2 i + 1}, {i_Integer -> 4 i}}]] &, {1}, 5], 32] (* Or *)
Select[Range[124], FreeQ[Length /@ Select[Split[IntegerDigits[#, 2]], First[#] == 0 &], _?OddQ] &] (* Birkas Gyorgy, May 29 2012 *)
PROG
(Haskell)
import Data.Set (singleton, deleteFindMin, insert)
a060142 n = a060142_list !! n
a060142_list = 0 : f (singleton 1) where
f s = x : f (insert (4 * x) $ insert (2 * x + 1) s') where
(x, s') = deleteFindMin s
-- Reinhard Zumkeller, Nov 26 2012
(PARI) is(n)=if(n<3, n<2, if(n%2, is(n\2), n%4==0 && is(n/4))) \\ Charles R Greathouse IV, Oct 21 2013
CROSSREFS
Cf. A003714 (no consecutive 1's in binary expansion).
Odd partitions are counted by A000009.
Numbers with an odd number of 1's in binary expansion are A000069.
Numbers whose binary expansion has odd length are A053738.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Compositions without odd parts are A062880.
- Sum is A070939.
- Product is A124758.
- Strict compositions are A233564.
- Heinz number is A333219.
- Number of distinct parts is A334028.
KEYWORD
nonn
AUTHOR
Clark Kimberling, Mar 05 2001
EXTENSIONS
Corrected by T. D. Noe, Nov 01 2006
Definition simplified by Charles R Greathouse IV, Oct 21 2013
STATUS
approved
a(n) = ceiling(n/tau), where tau = (1+sqrt(5))/2.
+10
19
1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 44, 45, 46, 46
OFFSET
1,2
COMMENTS
Average of first n terms of A019444, which is defined to be a permutation of the positive integers, p_1, p_2, ..., such that the average of each initial segment is an integer, using the greedy algorithm to define p_n.
Number of pairs (i,j) of nonnegative integers such that n-1=floor(i+j*tau). - Clark Kimberling, Jun 18 2002
The terms that occur exactly once are 1,3,6,8,..., given by A026352(n)=n+1+floor(n*tau). - Clark Kimberling, Jun 18 2002
The number n appears A001468(n) times. - Reinhard Zumkeller, Feb 02 2012
It seems that the indices of the terms that occur exactly once are listed in A276885. - Ivan N. Ianakiev, Aug 30 2018
From Michel Dekking, Oct 13 2020: (Start)
Here is a proof of the conjecture by Ivan N. Ianakiev. Let b = (b(n)) be the sequence of occurrences of the "singleton terms" in (a(n)). We have to show that b = A276885.
In the following phi := (1+sqrt(5))/2 (so phi = tau).
By its definition, the sequence (a(n)) is a generalized Beatty sequence with terms a(n) = floor(phi*n)-n+1, since 1/phi = phi-1. So by Lemma 8 in the paper by Allouche and Dekking, its sequence of first differences Delta = 1011010110..., given by Delta(n) = a(n+1)-a(n), is equal to y, where y = A005614 is the binary complement of the Fibonacci word. By definition, y is the fixed point of the morphism nu: 0->1, 1->10.
The crucial observation is that a term occurs exactly once in (a(n)) if and only if the word 11 of length 2 occurs in Delta (with an exception for a(1)=1). So to obtain the sequence b of occurrences of these "singleton terms", we have to study the return words of 11 in y. (The return words of 11 in y are the words occurring in y that start with 11, and having no other occurrences of 11.)
The return words of 11 are the words A:=11010, and B:=110. Since
nu(A) = nu(11010) = 10101101, nu(B) = nu(110) = 10101,
the morphism nu induces a descendant morphism tau given by
tau(A) = BA, tau(B) = A.
So tau is nothing else but the Fibonacci morphism on the alphabet {B,A}.
Since the words A and B have lengths 5 and 3, the first differences b(n+1)-b(n) are given by the fixed point z = 5353353533... of the Fibonacci morphism on the alphabet {5,3}.
From Lemma 8 in the paper by Allouche and Dekking we then obtain that the sequence b is a generalized Beatty sequence
V(n) = (5-3)*floor(phi*n)+(2*3-5)*n+r = 2*floor(phi*n)+n+r, for some integer r.
Starting at the value 4, filling in n=1, we obtain that r=1, and so V(n) = 2*floor(phi*n)+n+1. To incorporate also the first "singleton term" a(1)=1, we take
b(n) = V(n-1) = 2*floor(phi*(n-1))+n-1+1 = 2*floor(phi*(n-1))+n.
Then, indeed, b(n) = A276885(n), for n=1,2,... (see my Comment in A276885).
(End)
It seems that the indices of the records are listed in A026351. - Ivan N. Ianakiev, Mar 25 2021
LINKS
J.-P. Allouche and F. M. Dekking, Generalized Beatty sequences and complementary triples, arXiv:1809.03424 [math.NT], 2018.
Problem of the week, Problem 818
J. Rickard, Rearrangement of the natural numbers [Broken link]
FORMULA
a(1)=1; a(n) = n+1 - a(a(n-1)). - Benoit Cloitre, Nov 06 2002
a(n) = A005206(n-1) + 1. - Reinhard Zumkeller, Feb 02 2012; corrected by Primoz Pirnat, Dec 28 2020
a(n) = A019445(n) / n. - Sean A. Irvine, Mar 17 2019
EXAMPLE
a(6)=4 since 6-1=[i+j*tau] for these (i,j): (5,0), (4,1), (2,2), (1,3). - Clark Kimberling, Jun 18 2002
MAPLE
A019446:=n->ceil(2*n/(1+sqrt(5))); seq(A019446(n), 1..100); # Wesley Ivan Hurt, Jan 19 2014
MATHEMATICA
Ceiling[Range[80]/GoldenRatio] (* Harvey P. Dale, Aug 02 2011 *)
PROG
(Haskell)
a019446 n = a019446_list !! (n-1)
a019446_list = 1 : zipWith (-) [3..] (map a019446 a019446_list)
-- Reinhard Zumkeller, Feb 02 2012
(GAP) a:=[1];; for n in [2..80] do a[n]:=n+1-a[a[n-1]]; od; a; # Muniru A Asiru, Aug 30 2018
(Python)
from math import isqrt
def A019446(n): return (n+isqrt(5*n**2)>>1)-n+1 # Chai Wah Wu, Aug 09 2022
KEYWORD
nonn,easy,nice
AUTHOR
R. K. Guy, Tom Halverson (halverson(AT)macalester.edu)
EXTENSIONS
Better name from David Radcliffe and John Rickard, Dec 12 2000
Edited by Dean Hickerson, Nov 09 2002
STATUS
approved
a(1)=1, a(n) = a(n-1) + 3 if n is already in the sequence, a(n) = a(n-1) + 2 otherwise.
+10
13
1, 3, 6, 8, 10, 13, 15, 18, 20, 23, 25, 27, 30, 32, 35, 37, 39, 42, 44, 47, 49, 51, 54, 56, 59, 61, 64, 66, 68, 71, 73, 76, 78, 80, 83, 85, 88, 90, 93, 95, 97, 100, 102, 105, 107, 109, 112, 114, 117, 119, 122, 124, 126, 129, 131, 134, 136, 138, 141, 143, 146, 148, 150
OFFSET
1,2
COMMENTS
More generally let (x,y,z) be 3 positive integers and a(n) be the sequence a(1)=x, a(n) = a(n-1) + y if n is already in the sequence, a(n) = a(n-1) + z otherwise. Then it seems that a(n) is asymptotic to r*n where r is the largest positive root of q^2 = z*q + z - y.
Example: (x,y,z) = (2, 1, 2) gives A004956(n), (x,y,z) = (1, 2, 3) gives A007066(n). The present sequence is the case (1, 3, 2).
LINKS
Benoit Cloitre, N. J. A. Sloane and M. J. Vandermast, Numerical analogues of Aronson's sequence, J. Integer Seqs., Vol. 6 (2003), #03.2.2.
Benoit Cloitre, N. J. A. Sloane and M. J. Vandermast, Numerical analogues of Aronson's sequence, arXiv:math/0305308 [math.NT], 2003.
FORMULA
a(n) = ceiling((1+sqrt(2))*(n-1)+C) where C = 1/(2+sqrt(2)) = 0.292893218813...
EXAMPLE
a(6)=13 hence a(13) = a(12) + 3 = 27 + 3 = 30.
MAPLE
A064437:= n -> ceil((1+sqrt(2))*(n-1)+1/(2+sqrt(2))):
seq(A064437(n), n=1..100); # Robert Israel, May 19 2014
MATHEMATICA
a[1] = 1; a[n_] := a[n] = a[n-1] + If[MemberQ[Array[a, n-1], n], 3, 2];
Array[a, 100] (* Jean-François Alcover, Aug 01 2018 *)
PROG
(PARI) an=vector(100); an[1]=1; a(n)=if(n<0, 0, an[n]);
x=1; y=3; z=2; an[1]=x; for(n=2, 100, an[n]=if(setsearch(Set(vector(n- 1, i, a(i))), n), a(n-1)+y, a(n-1)+z));
an
(Haskell)
a064437 n = a064437_list !! (n-1)
a064437_list = 1 : f 2 [1] where
f x zs@(z:_) = y : f (x + 1) (y : zs) where
y = if x `elem` zs then z + 3 else z + 2
-- Reinhard Zumkeller, Sep 26 2014
CROSSREFS
Cf. A004956, A007066, A026351, A079000. Apart from start, equals A080652 + 1.
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Feb 14 2003
STATUS
approved
a(n) = ceiling(n*phi), where phi is the golden ratio, A001622.
+10
12
0, 2, 4, 5, 7, 9, 10, 12, 13, 15, 17, 18, 20, 22, 23, 25, 26, 28, 30, 31, 33, 34, 36, 38, 39, 41, 43, 44, 46, 47, 49, 51, 52, 54, 56, 57, 59, 60, 62, 64, 65, 67, 68, 70, 72, 73, 75, 77, 78, 80, 81, 83, 85, 86, 88, 89
OFFSET
0,2
COMMENTS
a(0)=0, a(1)=2; for n > 1, a(n) = a(n-1) + 2 if n is already in the sequence, a(n) = a(n-1) + 1 otherwise.
Integer solutions to the equation x = ceiling(phi*floor(x/phi)). - Benoit Cloitre, Feb 14 2004
From Benoit Cloitre, Mar 05 2007: (Start)
The following is an alternative way to obtain this sequence. NP means "term not in parentheses". Write down the natural numbers and mark the least NP, which is 1:
1* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
Take the first NP (which is 1) and parenthesize it; mark the least NP (which is 2):
(1*) 2* 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
Take the 2nd NP (which is 3) and parenthesize it; mark the next NP (which is 4):
(1*) 2* (3) 4* 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
Take the 4th NP (which is 6) and parenthesize it; mark the next NP (which is 5):
(1*) 2* (3) 4* 5* (6) 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
Continuing in this way we obtain
(1*) 2* (3) 4* 5* (6) 7* (8) 9* 10* (11) 12* 13* (14) 15* (16) 17* (18) 19* ...
The starred entries (after the first) give the sequence. (End)
From Rick L. Shepherd, Dec 05 2009: (Start)
An equivalent statement of the sieving process described by Benoit Cloitre on Mar 05 2007:
Begin with the natural numbers N. Repeatedly perform these two steps:
i) Let k = N's least remaining term not yet used in Step ii).
ii) Remove the k-th remaining term from N.
The remaining terms of N are the (positive) terms shared by this sequence and A026351.
The terms removed from N (the complement) are A026352's terms (see also A004957).
The PARI program performs this sieving process and prints the positive terms of this sequence. (End)
LINKS
B. Cloitre, N. J. A. Sloane and M. J. Vandermast, Numerical analogues of Aronson's sequence, J. Integer Seqs., Vol. 6 (2003), #03.2.2.
B. Cloitre, N. J. A. Sloane and M. J. Vandermast, Numerical analogues of Aronson's sequence, arXiv:math/0305308 [math.NT], 2003.
MATHEMATICA
Ceiling[Range[0, 100]GoldenRatio] (* Paolo Xausa, Oct 28 2023 *)
PROG
(PARI) {/* paws = Print Absolute values of all elements in vector v With same Sign as sn */
paws(v, sn) = for(m=1, matsize(v)[2], if(sign(v[m])==sign(sn), \
print1(abs(v[m]), ", ")))}
{/* Sieve through lim numbers; make values negative to signify "removed" */
lim=100; v=vector(lim, i, i); i=0; j=0; c=1;
while(i<lim, i++; if(v[i]>0, k=v[i]; c=c--;
while(c<k && j<lim, j++; if(v[j]>0, c++)); v[j]=-v[j])); paws(v, 1)\
/* Changing "1" to "-1" in paws() above prints out the terms of A026352 instead */} \\ Rick L. Shepherd, Dec 05 2009
(PARI) a(n) = ceil(n*(1 + sqrt(5))/2); \\ Michel Marcus, Apr 13 2021
CROSSREFS
Essentially same as A026351.
KEYWORD
nonn,easy
STATUS
approved
a(n) = floor((n-1)*phi) + n + 1, n > 0, where phi = (1+sqrt(5))/2.
+10
10
2, 4, 7, 9, 12, 15, 17, 20, 22, 25, 28, 30, 33, 36, 38, 41, 43, 46, 49, 51, 54, 56, 59, 62, 64, 67, 70, 72, 75, 77, 80, 83, 85, 88, 91, 93, 96, 98, 101, 104, 106, 109, 111, 114, 117, 119, 122, 125, 127, 130, 132, 135, 138, 140, 143, 145
OFFSET
1,1
COMMENTS
Greatest k such that s(k) = n+1, where s = A026354.
Positions of 1 in A189661.
a(n+1) = A001950(n)-2, the Upper Wythoff sequence shifted by 2. - Michel Dekking, Oct 18 2018
LINKS
MATHEMATICA
(See A189661.)
PROG
(PARI) r = (1 + sqrt(5))/2;
a(n) = if(n<1, 1, floor((n - 1)* r) + n + 1);
for(n=1, 100, print1(a(n), ", ")) \\ Indranil Ghosh, Mar 25 2017
(Python)
from sympy import sqrt
import math
r=(1 + sqrt(5))/2
def a(n): return 1 if n<1 else int(math.floor((n - 1)*r)) + n + 1
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Mar 25 2017
(Python)
from math import isqrt
def A026356(n): return (n+1+isqrt(5*(n-1)**2)>>1)+n # Chai Wah Wu, Aug 11 2022
CROSSREFS
Cf. A000201, A026351, etc. Apart from initial terms, same as A007066. Complement is A189662, closely related to A026355.
KEYWORD
nonn
EXTENSIONS
Data corrected by Michel Dekking, Oct 18 2018
STATUS
approved
a(n) = least k such that s(k) = n+1, where s = A026354.
+10
9
1, 2, 3, 5, 6, 8, 10, 11, 13, 14, 16, 18, 19, 21, 23, 24, 26, 27, 29, 31, 32, 34, 35, 37, 39, 40, 42, 44, 45, 47, 48, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 73, 74, 76, 78, 79, 81, 82, 84, 86, 87, 89, 90, 92, 94, 95, 97, 99, 100, 102, 103, 105, 107, 108, 110
OFFSET
0,2
COMMENTS
Let f(1)=1, f(2)=q and f(k+2) = f(k+1)+f(k)-n; a(n) is the smallest positive integer q such that f(k) -> infinity as k -> infinity. - Benoit Cloitre, Aug 04 2002
FORMULA
For n>0, a(n) = floor((n-1)*phi) + 2, where phi=(1+sqrt(5))/2.
Recurrences: a(n+1) = a(n)+(3 + sign(phi*n-a(n)))/2 for n>=0. Also a(n+1) = a(n) + 1 + A005614(n-2) for n>=2. - Benoit Cloitre, Aug 04 2002
PROG
(Python)
from math import isqrt
def A026355(n): return (n-1+isqrt(5*(n-1)**2)>>1)+2 if n else 1 # Chai Wah Wu, Aug 25 2022
CROSSREFS
Cf. A000201, A005614, A026351. Different from A007067.
KEYWORD
nonn,easy
STATUS
approved

Search completed in 0.075 seconds