A003156 A self-generating sequence (see Comments for definition).
1, 4, 5, 6, 9, 12, 15, 16, 17, 20, 21, 22, 25, 26, 27, 30, 33, 36, 37, 38, 41, 44, 47, 48, 49, 52, 55, 58, 59, 60, 63, 64, 65, 68, 69, 70, 73, 76, 79, 80, 81, 84, 85, 86, 89, 90, 91, 94, 97, 100, 101, 102, 105, 106, 107, 110, 111, 112, 115, 118, 121, 122, 123, 126, 129, 132
Offset: 1
Keywords
A003157 A self-generating sequence (see Comments in A003156 for the definition).
3, 8, 11, 14, 19, 24, 29, 32, 35, 40, 43, 46, 51, 54, 57, 62, 67, 72, 75, 78, 83, 88, 93, 96, 99, 104, 109, 114, 117, 120, 125, 128, 131, 136, 139, 142, 147, 152, 157, 160
Offset: 1
Keywords
Comments
Indices of c in the sequence closed under a -> abc, b -> a, c -> a, starting with a(1) = a; see A092606 where a = 0, b = 2, c = 1. - Philippe Deléham, Apr 12 2004
These are the positions of 1 in A286044; complement of A286045; conjecture: a(n)/n -> 4. - Clark Kimberling, May 07 2017
Examples
As a word, A286044 = 001000010010010000100..., in which 1 is in positions a(n) for n>=1. - _Clark Kimberling_, May 07 2017
References
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- Clark Kimberling, Table of n, a(n) for n = 1..10000
- L. Carlitz, R. Scoville, and V. E. Hoggatt, Jr., Representations for a special sequence, Fibonacci Quarterly 10.5 (1972), 499-518, 550.
Programs
-
Mathematica
s = Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {1, 0}}] &, {0}, 9] (* Thue-Morse, A010060 *) w = StringJoin[Map[ToString, s]] w1 = StringReplace[w, {"011" -> "0"}] st = ToCharacterCode[w1] - 48 (* A286044 *) Flatten[Position[st, 0]] (* A286045 *) Flatten[Position[st, 1]] (* A003157 *) (* Clark Kimberling, May 07 2017 *)
-
Python
def A003157(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 kmin = kmax >> 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): c, s = n+x, bin(x)[2:] l = len(s) for i in range(l&1,l,2): c -= int(s[i])+int('0'+s[:i],2) return c return bisection(f,n,n)+n # Chai Wah Wu, Jan 29 2025
Formula
Numbers n such that A003159(n) is even. a(n) = A003158(n) + 1 = A036554(n) + n. - Philippe Deléham, Feb 22 2004
A232744 Numbers k for which the largest m such that m! divides k is odd.
1, 3, 5, 6, 7, 9, 11, 12, 13, 15, 17, 18, 19, 21, 23, 25, 27, 29, 30, 31, 33, 35, 36, 37, 39, 41, 42, 43, 45, 47, 49, 51, 53, 54, 55, 57, 59, 60, 61, 63, 65, 66, 67, 69, 71, 73, 75, 77, 78, 79, 81, 83, 84, 85, 87, 89, 90, 91, 93, 95, 97, 99, 101, 102, 103, 105
Offset: 1
Keywords
Comments
Numbers k for which A055881(k) is odd.
Equally: Numbers k which have an even number of the trailing zeros in their factorial base representation A007623(k).
The sequence can be described in the following manner: Sequence includes all multiples of 1!, except that it excludes from those the multiples of 2!, except that it includes the multiples of 3! (6), except that it excludes the multiples of 4! (24), except that it includes the multiples of 5! (120), except that it excludes the multiples of 6! (720), except that it includes the multiples of 7! (5040), except that it excludes the multiples of 8! (40320), except that it includes the multiples of 9! (362880), and so on, ad infinitum.
The number of terms not exceeding m! for m>=1 is A002467(m). The asymptotic density of this sequence is 1 - 1/e (A068996). - Amiram Eldar, Feb 26 2021
Links
- Antti Karttunen, Table of n, a(n) for n = 1..9558
Crossrefs
Programs
-
Mathematica
seq[max_] := Select[Range[max!], EvenQ @ LengthWhile[Reverse @ IntegerDigits[#, MixedRadix[Range[max, 2, -1]]], #1 == 0 &] &]; seq[5] (* Amiram Eldar, Feb 26 2021 *)
A334747 Let p be the smallest prime not dividing the squarefree part of n. Multiply n by p and divide by the product of all smaller primes.
2, 3, 6, 8, 10, 5, 14, 12, 18, 15, 22, 24, 26, 21, 30, 32, 34, 27, 38, 40, 42, 33, 46, 20, 50, 39, 54, 56, 58, 7, 62, 48, 66, 51, 70, 72, 74, 57, 78, 60, 82, 35, 86, 88, 90, 69, 94, 96, 98, 75, 102, 104, 106, 45, 110, 84, 114, 87, 118, 120, 122, 93, 126, 128, 130, 55
Offset: 1
Comments
A bijection from the positive integers to the nonsquares, A000037.
A003159 (which has asymptotic density 2/3) lists index n such that a(n) = 2n. The sequence maps the terms of A003159 1:1 onto A036554, defining a bijection between them.
Similarly, bijections are defined from A007417 to A325424, from A325424 to A145204\{0}, and from the first in each of the following pairs to the nonsquare integers in the second: (A145204\{0}, A036668), (A036668, A007417), (A036554, A003159), (A332820, A332821), (A332821, A332822), (A332822, A332820). Note that many of these are between sets where membership depends on whether a number's squarefree part divides by 2 and/or 3.
Starting from 1, and iterating the sequence as a(1) = 2, a(2) = 3, a(3) = 6, a(6) = 5, a(5) = 10, etc., runs through the squarefree numbers in the order they appear in A019565. - Antti Karttunen, Jun 08 2020
Examples
168 = 42*4 has squarefree part 42 (and square part 4). The smallest prime absent from 42 = 2*3*7 is 5 and the product of all smaller primes is 2*3 = 6. So a(168) = 168*5/6 = 140.
Crossrefs
Permutation of A000037.
The formula section details how the sequence maps the terms of A002110, A003961, A019565; and how f(a(n)) relates to f(n) for f = A008833, A048675, A267116; making use of A003986.
Programs
-
PARI
a(n) = {my(c=core(n), m=n); forprime(p=2, , if(c % p, m*=p; break, m/=p)); m;} \\ Michel Marcus, May 22 2020
Formula
a(k * m^2) = a(k) * m^2.
a(A002110(n)) = prime(n+1).
A334870(a(n)) = n. - Antti Karttunen, Jun 08 2020
A372591 Numbers whose binary weight (A000120) plus bigomega (A001222) is even.
2, 6, 7, 8, 9, 10, 11, 13, 15, 19, 24, 28, 31, 32, 33, 34, 36, 37, 39, 40, 41, 42, 44, 46, 47, 50, 51, 52, 54, 57, 58, 59, 60, 61, 65, 67, 70, 73, 76, 77, 79, 85, 86, 90, 95, 96, 97, 98, 103, 106, 107, 109, 110, 111, 112, 117, 119, 123, 124, 126, 127, 128, 129
Offset: 1
Keywords
Comments
The odd version is A372590.
Examples
The terms (center), their binary indices (left), and their weakly decreasing prime indices (right) begin: {2} 2 (1) {2,3} 6 (2,1) {1,2,3} 7 (4) {4} 8 (1,1,1) {1,4} 9 (2,2) {2,4} 10 (3,1) {1,2,4} 11 (5) {1,3,4} 13 (6) {1,2,3,4} 15 (3,2) {1,2,5} 19 (8) {4,5} 24 (2,1,1,1) {3,4,5} 28 (4,1,1) {1,2,3,4,5} 31 (11) {6} 32 (1,1,1,1,1) {1,6} 33 (5,2) {2,6} 34 (7,1) {3,6} 36 (2,2,1,1) {1,3,6} 37 (12) {1,2,3,6} 39 (6,2) {4,6} 40 (3,1,1,1) {1,4,6} 41 (13) {2,4,6} 42 (4,2,1)
Crossrefs
Programs
-
Mathematica
Select[Range[100],EvenQ[DigitCount[#,2,1]+PrimeOmega[#]]&]
A161641 Positions n such that A010060(n) + A010060(n+4) = 1.
0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 24, 25, 26, 27, 32, 33, 34, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 96, 97, 98, 99, 104, 105, 106, 107, 108
Offset: 1
Keywords
Comments
Also union of all numbers of the form A131323(n)-k, k=0, 1, 2, or 3.
Links
- G. C. Greubel, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 16000, n++, If[tm[n] + tm[n + 4] == 1, Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 01 2018 *)
-
PARI
is(n)=hammingweight(n)%2!=hammingweight(n+4)%2 \\ Charles R Greathouse IV, Aug 20 2013
Extensions
More terms from R. J. Mathar, Aug 17 2009
A161674 Positions n such that A010060(n) + A010060(n+2) = 1.
0, 1, 4, 5, 6, 7, 8, 9, 12, 13, 16, 17, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 44, 45, 48, 49, 52, 53, 54, 55, 56, 57, 60, 61, 64, 65, 68, 69, 70, 71, 72, 73, 76, 77, 80, 81, 84, 85, 86, 87, 88, 89, 92, 93, 94, 95, 96, 97, 100, 101, 102, 103, 104
Offset: 1
Comments
Locates patterns of the form 0x1 or 1x0 in the Thue-Morse sequence.
Also union of sequences {A079523(n)-k}, k=0 or 1. For a generalization see A161890. - Vladimir Shevelev, Jul 05 2009
The asymptotic density of this sequence is 2/3 (Rowland and Yassawi, 2015; Burns, 2016). - Amiram Eldar, Jan 30 2021
Links
- G. C. Greubel, Table of n, a(n) for n = 1..10000
- Rob Burns, Asymptotic density of Motzkin numbers modulo small primes, arXiv:1611.04910 [math.NT], 2016.
- Eric Rowland and Reem Yassawi, Automatic congruences for diagonals of rational functions, Journal de Théorie des Nombres de Bordeaux, Vol. 27, No. 1 (2015), pp. 245-288.
Crossrefs
Programs
-
Mathematica
tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 6000, n++, If[tm[n] + tm[n + 2] == 1, Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 05 2018 *) Flatten[Position[Partition[ThueMorse[Range[0,120]],3,1],?(#[[1]]+#[[3]] == 1&),1,Heads->False]]-1 (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale, Oct 29 2019 *)
-
PARI
is(n)=hammingweight(n)%2!=hammingweight(n+2)%2 \\ Charles R Greathouse IV, Aug 20 2013
Extensions
Extended by R. J. Mathar, Aug 28 2009
A372588 Numbers k > 1 such that (greatest binary index of k) + (greatest prime index of k) is odd.
2, 6, 7, 8, 10, 11, 15, 18, 19, 21, 24, 26, 27, 28, 29, 32, 33, 34, 40, 41, 44, 45, 46, 47, 50, 51, 55, 59, 60, 62, 65, 70, 71, 72, 74, 76, 78, 79, 81, 84, 86, 87, 89, 91, 95, 96, 98, 101, 104, 105, 106, 107, 108, 111, 112, 113, 114, 116, 117, 122, 126, 128
Offset: 1
Keywords
Comments
Examples
The terms (center), their binary indices (left), and their weakly decreasing prime indices (right) begin: {2} 2 (1) {2,3} 6 (2,1) {1,2,3} 7 (4) {4} 8 (1,1,1) {2,4} 10 (3,1) {1,2,4} 11 (5) {1,2,3,4} 15 (3,2) {2,5} 18 (2,2,1) {1,2,5} 19 (8) {1,3,5} 21 (4,2) {4,5} 24 (2,1,1,1) {2,4,5} 26 (6,1) {1,2,4,5} 27 (2,2,2) {3,4,5} 28 (4,1,1) {1,3,4,5} 29 (10) {6} 32 (1,1,1,1,1) {1,6} 33 (5,2) {2,6} 34 (7,1) {4,6} 40 (3,1,1,1) {1,4,6} 41 (13) {3,4,6} 44 (5,1,1) {1,3,4,6} 45 (3,2,2)
Crossrefs
Programs
-
Mathematica
Select[Range[2,100],OddQ[IntegerLength[#,2]+PrimePi[FactorInteger[#][[-1,1]]]]&]
A072939 Define a sequence c depending on n as follows: c(1)=1 and c(2)=n; c(k+2) = (c(k+1) + c(k))/2 if c(k+1) and c(k) have the same parity; otherwise c(k+2) = abs(c(k+1) - 2*c(k)); sequence gives values of n such that lim_{k->oo} c(k) = infinity.
3, 7, 9, 11, 15, 19, 23, 25, 27, 31, 33, 35, 39, 41, 43, 47, 51, 55, 57, 59, 63, 67, 71, 73, 75, 79, 83, 87, 89, 91, 95, 97, 99, 103, 105, 107, 111, 115, 119, 121, 123, 127, 129, 131, 135, 137, 139, 143, 147, 151, 153, 155, 159, 161, 163, 167, 169, 171, 175, 179
Offset: 1
Keywords
Comments
If c(2) is even then c(k) = 1 for k >= 2*c(2), hence there is no even value in the sequence. If n is in the sequence, there exist an integer k(n) and an integer m(n) such that, for any k >= k(n), c(2k) - c(2k-1) = 2*m(n) and c(2k+1) - c(2k) = -m(n). Sometimes m(n) = (n-1)/2 but not always. If B(n) = a(n+1) - a(n) then B(n) = 2 or 4, but B(n) does not seem to follow any pattern.
Conjecture: a(n) = A036554(n)+1. - Vladeta Jovovic, Apr 01 2003
Conjecture: this sequence gives the positions of 0's in the limiting 0-word of the morphism 0->11, 1->10, A285384. - Clark Kimberling, Apr 26 2017
Conjecture: This also gives the positions of the 1's in A328979. - N. J. A. Sloane, Nov 05 2019
Examples
41 is in the sequence: if c(2)=41, then it follows that c(3)=21, c(4)=31, c(5)=26, c(6)=36, c(7)=31, c(8)=41, c(9)=36, ...; for k >= 2, c(2k) - c(2k-1) = 10 and c(2k+1) - c(2k) = -5, which implies that c(k) -> infinity.
Programs
-
Python
from itertools import count, islice def A072939_gen(startvalue=2): return filter(lambda n:(~(n-1)&(n-2)).bit_length()&1,count(max(startvalue,2))) # generator of terms >= startvalue A072939_list = list(islice(A072939_gen(),30)) # Chai Wah Wu, Jul 05 2022
-
Python
def A072939(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 kmin = kmax >> 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): c, s = n+x, bin(x)[2:] l = len(s) for i in range(l&1,l,2): c -= int(s[i])+int('0'+s[:i],2) return c return bisection(f,n,n)+1 # Chai Wah Wu, Jan 29 2025
Formula
Conjecture: lim_{n->oo} a(n)/n = 3.
A101544 Smallest permutation of the natural numbers with a(3*k-2) + a(3*k-1) = a(3*k), k > 0.
1, 2, 3, 4, 5, 9, 6, 7, 13, 8, 10, 18, 11, 12, 23, 14, 15, 29, 16, 17, 33, 19, 20, 39, 21, 22, 43, 24, 25, 49, 26, 27, 53, 28, 30, 58, 31, 32, 63, 34, 35, 69, 36, 37, 73, 38, 40, 78, 41, 42, 83, 44, 45, 89, 46, 47, 93, 48, 50, 98, 51, 52, 103, 54, 55, 109, 56, 57, 113, 59, 60
Offset: 1
Keywords
Comments
From Bernard Schott, Jun 30 2019: (Start)
The terms can also be written simply following this array with 3 columns:
1st column 2nd column 3rd column
1 + 2 = 3
4 + 5 = 9
6 + 7 = 13
8 + 10 = 18
11 + 12 = 23
14 + 15 = 29
16 + 17 = 33
... ... ...
Question: in which column ends up the repdigit R_m(d) with m times the digit d?
Answer: R_m(d) will be in:
1) column 1 if d = 1, 4, 6, 8, or if d = 9 and m is even;
2) column 2 if d = 2, 5, 7;
3) column 3 if d = 3, or if d = 9 and m is odd.
Problem coming from Krusemeyer et al. (End)
Links
- Ivan Neretin, Table of n, a(n) for n = 1..10000
- Mark I. Krusemeyer, George T. Gilbert, Loren C. Larson, A Mathematical Orchard, Problems and Solutions, MAA, 2012, Problem 99, pp. 179-181.
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Maple
N:= 100: # to get a(1) .. a(N) S:= {$1..N}: for n from 1 to N do if n mod 3 = 0 then A[n] := A[n-1]+A[n-2] else A[n]:= min(S) fi; S:= S minus {A[n]}; od: seq(A[i],i=1..N); # Robert Israel, Feb 07 2016
-
Mathematica
Fold[Append[#1, If[Divisible[#2, 3], #1[[-1]] + #1[[-2]], Min@Complement[Range[Max@#1 + 1], #1]]] &, {1}, Range[2, 71]] (* Ivan Neretin, Feb 05 2016 *)
-
PARI
A101544_upto(N, U=[], T=0)=vector(N, n, if(n%=3, while(if(U, U[1])==T+=1, U=U[^1]); n>1 || N=T; T, U=concat(U, N+=T); N)) apply( {A101544(n, k=(n-=1)\12, m=n\3%4, c=n%3)=(10*k+3*m-(m>1))<<(c>1)+c+(m<3 || c==1 || valuation(k+1,2)%2)}, [1..99]) \\ M. F. Hasler, Nov 26 2024
Formula
From Rémy Sigrist, Apr 05 2020: (Start)
- a(3*n-2) = A249031(2*n-1),
- a(3*n-1) = A249031(2*n),
- a(3*n) = A075326(n).
(End)
a(3*(4k + m) + c) = (10k + 3m - [m>1])*2^[c=3] + c - [m = 3 and c <> 2 and k+1 is in A036554], where 1 <= c <= 3, 0 <= m <= 3, and [.] is the Iverson bracket. - M. F. Hasler, Nov 26 2024
Comments
References
Links
Crossrefs
Programs
Haskell
Maple
Mathematica
Python
Formula
Extensions