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-7 of 7 results.

A303779 Restricted growth sequence transform of A278222(A303775(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 06 2018

Keywords

Crossrefs

Programs

  • PARI
    \\ Needs also code from A303775:
    rgs_transform(invec) = { my(occurrences = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(occurrences,invec[i]), my(pp = mapget(occurrences, invec[i])); outvec[i] = outvec[pp] , mapput(occurrences,invec[i],i); outvec[i] = u; u++ )); outvec; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t };
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    A278222(n) = A046523(A005940(1+n));
    write_to_bfile(0,rgs_transform(vector(65538,n,A278222(A303775(n-1)))),"b303779.txt");

Formula

For all i, j: a(i) = a(j) => A303780(i) = A303780(j).

A303780 Binary weight of A303775(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 06 2018

Keywords

Crossrefs

Cf. also A304089.

Programs

Formula

a(n) = A000120(A303775(n)).
For all n >= 0, abs(a(n+1)-a(n)) = A000120(A303775(n+1) XOR A303775(n)), where XOR is a bitwise exclusive or, A003987.

A303778 Divisor-or-multiple permutation of squarefree numbers: a(n) = A019565(A303775(n)).

Original entry on oeis.org

1, 2, 6, 3, 15, 5, 10, 30, 210, 105, 35, 7, 70, 14, 42, 21, 1155, 11, 22, 66, 33, 330, 55, 110, 2310, 165, 2145, 429, 143, 13, 858, 286, 26, 4290, 1430, 715, 65, 5005, 385, 77, 770, 154, 462, 231, 30030, 10010, 2002, 1001, 91, 15015, 3003, 39, 6006, 78, 390, 195, 1365, 455, 910, 130, 2730, 182, 546, 273, 4641, 17, 1870, 935, 187, 2805, 561, 51, 5610, 374, 34
Offset: 0

Views

Author

Antti Karttunen, May 06 2018

Keywords

Comments

Each a(n+1) is either a divisor or a multiple of a(n).

Crossrefs

Cf. also A304087.

Programs

Formula

a(n) = A019565(A303775(n)).

A303776 Inverse permutation to A303775.

Original entry on oeis.org

0, 1, 3, 2, 5, 6, 4, 7, 11, 13, 15, 14, 10, 12, 9, 8, 17, 18, 20, 19, 22, 23, 25, 21, 39, 41, 43, 42, 38, 40, 16, 24, 29, 32, 51, 53, 36, 59, 55, 54, 48, 61, 63, 62, 57, 58, 56, 60, 28, 31, 27, 30, 35, 34, 26, 33, 47, 46, 50, 52, 37, 45, 49, 44, 65, 74, 71, 76, 86, 88, 90, 89, 80, 82, 92, 93, 96, 95, 91, 94, 68, 73, 70, 75, 67, 66, 69, 72, 79, 81
Offset: 0

Views

Author

Antti Karttunen, May 05 2018

Keywords

Crossrefs

Cf. A303775 (inverse).

Programs

  • PARI
    \\ Use program given in A303775.

A303767 May code of n: a(0) = 0, and for n > 0, if n = 2^k, a(n) = n + a(n-1), otherwise, when n = 2^k + r (with 0 < r < 2^k), then a(n) = 2^k + a(r-1); see comments for equivalent alternative descriptions.

Original entry on oeis.org

0, 1, 3, 2, 6, 4, 5, 7, 15, 8, 9, 11, 10, 14, 12, 13, 29, 16, 17, 19, 18, 22, 20, 21, 23, 31, 24, 25, 27, 26, 30, 28, 60, 32, 33, 35, 34, 38, 36, 37, 39, 47, 40, 41, 43, 42, 46, 44, 45, 61, 48, 49, 51, 50, 54, 52, 53, 55, 63, 56, 57, 59, 58, 62, 126, 64, 65, 67, 66, 70, 68, 69, 71, 79, 72, 73, 75, 74, 78, 76, 77, 93, 80, 81
Offset: 0

Views

Author

Antti Karttunen, May 02 2018

Keywords

Comments

This is also "minimal subset/superset bitmask" transform of the nonnegative integers, A001477. In that transform, applicable to any N -> N injection f, we start from a(0) = 0, after which for n > 0, if there are one or more k_i that are not already present in the sequence among terms a(0) .. a(n-1), and for which bitor(k_i,a(n-1)) = a(n-1), then a(n) = that k_i for which f(k_i) is minimized; otherwise, a(n) = that h_i for which f(h_i) is minimized among the infinite set of numbers h_i for which bitand(h_i,a(n-1)) = a(n-1) and that are not yet present in the sequence. In this case f(n) = A001477(n) = n.
The original, equivalent definition is:
a(0) = 0 and for n > 0, if there are one or more k_i that are not already present in the sequence among terms a(0) .. a(n-1), and for which bitor(k_i,a(n-1)) = a(n-1), then a(n) = that k_i which gives minimum value of A019565(k_i) amongst them; otherwise, when no such k_i exists, a(n) = the least number not already present that can be obtained by toggling a single 0-bit of a(n-1) to 1. This is done by trying to toggle successive vacant bits from the least significant end of the binary representation of a(n-1), until such a sum a(n-1) + 2^h (= a(n-1) bitxor 2^h) is found that is not already present in the sequence.
Shares with permutations like A003188, A006068, A300838, A302846, A303765 and A304083 the property that when moving from any a(n) to a(n+1) either a subset of 0-bits are toggled on (changed to 1's), or a subset of 1-bits are toggled off (changed to 0's), but no both kind of changes may occur at the same step.
Also, like A003188, A006068 and many other base-2 representation related permutations, this permutation preserves the binary size of n (A000523(n)), and furthermore, a(n) seems to stay at most points (except at powers of 2) remarkably close to n.
From Antti Karttunen, May 23 2018: (Start)
Outline of the proof that the definition involving A019565 is equivalent to the recurrent formula:
Even though A019565 is nonmonotonic, for example A019565(4) = 5 = p_3 < A019565(3) = 6 = p_1 * p_2, and in general, although there are always primes p_k < p_{i1} * p_{i2} * ... * p_{ih}, with i1, i2, ..., ih < k, it doesn't matter here, because not just the position of the most significant 1-bit is monotonic in this sequence (see the binary representation at A304747), but also in each subrange (2^k)+2 .. (2^(k+1))-1 the position of the second most significant 1-bit moves only leftward, i.e., is monotonic, which follows from the recursive formula.
To see this, consider the first time in this sequence when in a batch of terms (of equal binary width) we have bits in position k (the most significant position) and (k-1) on (that is, both are 1's), the latter corresponding to prime p_k: while in principle a bit-based rule could choose to subtract 2^(k-1), in preference to any 1-bits to the right of it (that correspond to primes p_{i1} .. p_{ih}), it cannot do so at this stage, because it is the second most significant 1-bit, and then it would not move only leftward, contradicting what was said above. Neither this can occur later when more 1-bits have appeared to their left: the recursive formula guarantees it.
Also conversely, even though p_4 = 7 > 6 = p_1 * p_2, and in general, we always have such prime p_k > p_{i1} * p_{i2} * ... * p_{ih}, with i1, i2, ..., ih < k, and while here A019565-based rule (see comments in A303760) would prefer dividing p_k out instead of any subset of p_{i1} .. p_{ih}, it happens that in that rule, the index of the largest prime (A061395) grows monotonically, so at the stage where p_k is the largest prime of the batch of length 2^(k-1), p_k just cannot be divided out, and also here the structure of the later batches is strictly determined by recursion.
(End)

Examples

			From _Michael De Vlieger_, May 23 2018: (Start)
Table below shows the initial 17 terms at right. First column is index n,
second shows "." if A303760(n) = largest divisor of A303760(n-1), or factor p.
   n     p\d  m=A303760(n)  A054841(m)    a(n)
  -------------------------------------------
   0       .        1               0       0
   1       2        2               1       1
   2       3        6              11       3
   3       .        3              10       2
   4       5       15             110       6
   5       .        5             100       4
   6       2       10             101       5
   7       3       30             111       7
   8       7      210            1111      15
   9       .        7            1000       8
  10       2       14            1001       9
  11       3       42            1011      11
  12       .       21            1010      10
  13       5      105            1110      14
  14       .       35            1100      12
  15       2       70            1101      13
  16      11      770           11101      29
  ...  (End)
		

Crossrefs

Cf. A303768 (inverse), A304747 (terms shown in base-2).
Cf. also A303763, A303765, A303769, A303775, A304083 (similar sequences).

Programs

  • Mathematica
    Map[FromDigits[#, 2] &@ Reverse@ If[# == 1, {0}, Function[f, ReplacePart[Table[0, {PrimePi[f[[-1, 1]]]}], #] &@ Map[PrimePi@ First@ # -> Last@ # &, f]]@ FactorInteger@ #] &@# &, Nest[Append[#, Block[{d = Divisors@ #[[-1]], p = 2}, If[Complement[d, #] != {}, Complement[d, #][[1]], While[Nand[Mod[#[[-1]], p] != 0, FreeQ[#, p #[[-1]] ] ], p = NextPrime@ p]; p #[[-1]] ] ] ] &, {1}, 83]] (* Michael De Vlieger, May 23 2018 *)
  • PARI
    A209229(n) = (n && !bitand(n,n-1));
    A053644(n) = { my(k=1); while(k<=n, k<<=1); (k>>1); }; \\ From A053644
    A303767(n) = if(!n,n,if(A209229(n),n+A303767(n-1),A053644(n)+A303767(n-A053644(n)-1))); \\ Program based on new recurrence added May 06 2018
    
  • PARI
    up_to = (2^7)-1;
    A006519(n) = (2^valuation(n, 2));
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ From A019565
    A048675(n) = { my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; };
    v303767 = vector(up_to);
    m303768 = Map();
    w=1; for(n=1,up_to,s = Set([]); for(m=1,w, if((bitor(w,m)==w) && !mapisdefined(m303768,m), s = setunion(Set([A019565(m)]),s))); if(length(s)>0, w = A048675(vecmin(s)), b=A006519(1+w); while(bitand(w,b) || mapisdefined(m303768,w+b), b <<= 1); w += b); v303767[n] = w; mapput(m303768,w,n));
    A303767(n) = if(!n,n,v303767[n]);
    A303768(n) = if(!n,n,mapget(m303768,n));

Formula

a(0) = 0, and for n > 0, if n = 2^k, a(n) = n + a(n-1), otherwise, when n = 2^k + r (with 0 < r < 2^k), then a(n) = 2^k + a(r-1). \\ Antti Karttunen, May 06 2018
a(n) = A048675(A303760(n)).
a(n) = A052331(A303771(n)).
For all n >= 1, A000523(a(n)) = A000523(n), A007088(a(n)) = A304747(n).

Extensions

Name replaced with an equivalent, but simpler definition by Antti Karttunen, May 06 2018

A304083 Permutation of nonnegative integers: Minimal subset/superset bitmask transform of A054429.

Original entry on oeis.org

0, 1, 3, 2, 7, 6, 4, 5, 15, 14, 12, 8, 13, 9, 11, 10, 31, 30, 28, 24, 16, 29, 25, 17, 27, 26, 18, 23, 22, 20, 21, 63, 19, 59, 58, 56, 48, 32, 62, 60, 52, 36, 61, 57, 49, 33, 55, 54, 50, 34, 51, 35, 47, 46, 44, 40, 45, 41, 43, 42, 127, 53, 37, 39, 38, 126, 124, 120, 112, 96, 64, 125, 121, 113, 97, 65, 123, 122, 114, 98, 66, 119, 118, 116, 100, 68, 117, 101
Offset: 0

Views

Author

Antti Karttunen, May 06 2018

Keywords

Comments

In "minimal subset/superset bitmask transform", applicable to any N -> N injection f, we start from a(0) = 0, after which for n > 0, if there are one or more k_i that are not already present in the sequence among terms a(0) .. a(n-1), and for which bitor(k_i,a(n-1)) = a(n-1), then a(n) = that k_i for which f(k_i) is minimized; otherwise, a(n) = that h_i for which f(h_i) is minimized among the infinite set of numbers h_i for which bitand(h_i,a(n-1)) = a(n-1) and that are not yet present in the sequence. In this case f(n) = A054429(n).
Shares with permutations like A003188, A006068, A163252, A300838, A302846, A303763, A303765, A303767, A303773 and A303775 the property that when moving from any a(n) to a(n+1) either a subset of 0-bits are toggled on (changed to 1's), or a subset of 1-bits are toggled off (changed to 0's), but no both kind of changes may occur at the same step. Note that A303767 is obtained when the same transform is applied to A001477, and A303775 when it is applied to A193231.

Examples

			After a(3) = 2, "10" in binary, there are no submasks that wouldn't have been used, so one selects from supermasks h_i = "110" (6), "111" (7), "1010" (10), "1011" (11), "1110" (14), "1111" (15), "10010" (18), "10011" (19), etc. that one for which A054429(h_i) is minimized, which happens to be at 6 (as A054429(6) = 5, but A054429(7) = 4, and for n >= 8, A054429(n) >= 8), thus a(4) = 7.
After a(4) = 7, "111" in binary, the submasks "1", "10", and "11" (1-3) are already present in sequence, while submasks "100", "101", "110" (4-6) are not present, and because A054429 is minimized on these three at 6, a(5) = 6.
		

Crossrefs

Cf. A304084 (inverse).
Cf. A054429.

Programs

  • PARI
    allocatemem(2^30);
    default(parisizemax,2^31);
    up_to = (2^17)+2;
    A054429(n) = ((3<<#binary(n\2))-n-1);
    find_minimal_submask_for_A054429(n,m_inverses) = { my(minval=0,minmask=0); for(m=1,n,if((bitor(m,n)==n) && !mapisdefined(m_inverses,m) && (!minval || (A054429(m) < minval)), minval = A054429(m); minmask = m)); (minmask); };
    find_minimal_supermask_for_A054429(n,m_inverses) = { my(minval=0,minmask=0); for(m=1,(1<<(1+#binary(n)))-1,if((bitand(m,n)==n) && !mapisdefined(m_inverses,m) && (!minval || (A054429(m) < minval)), minval = A054429(m); minmask = m)); (minmask); };
    v304083 = vector(up_to);
    m304084 = Map();
    w=1; for(n=1,up_to,s = Set([]); if((submask = find_minimal_submask_for_A054429(w,m304084)), w = submask, w = find_minimal_supermask_for_A054429(w,m304084)); v304083[n] = w; mapput(m304084,w,n));
    A304083(n) = if(!n,n,v304083[n]);
    A304084(n) = if(!n,n,mapget(m304084,n));

Formula

Derived sequences:
A052330(a(n)) = A304085(n).
A019565(a(n)) = A304087(n).
A000120(a(n)) = A304089(n).

A303773 Permutation of nonnegative integers constructed with a greedy algorithm producing either-subset-or-superset-mask type of walk in binary lattice (see comments for the exact definition).

Original entry on oeis.org

0, 1, 3, 2, 6, 4, 5, 7, 15, 11, 10, 8, 9, 13, 12, 14, 30, 22, 20, 16, 17, 19, 18, 26, 24, 25, 27, 31, 23, 21, 29, 28, 60, 44, 40, 32, 33, 35, 34, 38, 36, 37, 39, 47, 41, 43, 42, 46, 62, 58, 50, 48, 49, 51, 55, 53, 52, 54, 118, 82, 66, 64, 65, 67, 71, 69, 68, 70, 78, 74, 72, 73, 75, 79, 77, 76, 92, 88, 80, 81, 83, 87, 85, 84, 86, 94, 90, 91, 89, 93, 95, 127
Offset: 0

Views

Author

Antti Karttunen, May 05 2018

Keywords

Comments

a(0) = 0 and for n > 0, if there are one or more k_i that are not already present in the sequence among terms a(0) .. a(n-1), and for which bitor(k_i,a(n-1)) = a(n-1), then a(n) = that k_i which gives minimum value of A003961(k_i) amongst them; otherwise, when no such k_i exists, a(n) = the least number not already present that can be obtained by toggling a single 0-bit of a(n-1) to 1. This is done by trying to toggle successive vacant bits from the least significant end of the binary representation of a(n-1), until such a sum a(n-1) + 2^h (= a(n-1) bitxor 2^h) is found that is not already present in the sequence.
Shares with permutations like A003188, A006068, A163252, A300838, A302846, A303763, A303765, A303767 and A303775 the property that when moving from any a(n) to a(n+1) either a subset of 0-bits are toggled on (changed to 1's, in this case always only a single bit), or a subset of 1-bits are toggled off (changed to 0's), but no both kind of changes may occur at the same step.

Crossrefs

Cf. A303774 (inverse).
Cf. A303770.
Cf. A303763, A303765, A303767, A303775 for similar constructions.

Programs

  • PARI
    up_to = (2^18)-1;
    A006519(n) = (2^valuation(n, 2));
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From A003961
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    v303773 = vector(up_to);
    m303774 = Map();
    w=1; for(n=1,up_to,s = Set([]); for(m=1,w, if((bitor(w,m)==w) && !mapisdefined(m303774,m), s = setunion(Set([A003961(m)]),s))); if(length(s)>0, w = A064989(vecmin(s)), b=A006519(1+w); while(bitand(w,b) || mapisdefined(m303774,w+b), b <<= 1); w += b); v303773[n] = w; mapput(m303774,w,n));
    A303773(n) = if(!n,n,v303773[n]);
    A303774(n) = if(!n,n,mapget(m303774,n));

Formula

For all n >= 0, A019565(a(n)) = A303770(n).
Showing 1-7 of 7 results.