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

A360307 Inverse of sequence A163252 considered as a permutation of the nonnegative integers.

Original entry on oeis.org

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

Views

Author

Alois P. Heinz, Feb 02 2023

Keywords

Comments

Fixed points of this sequence (and of A163252) are: 0, 1, 7, 30, 31, 35, 49, 55, 127, 150, 184, 226, 240, 241, 247, 320, 480 ... .

Examples

			a(8) = 11 because A163252(11) = 8.
		

Crossrefs

Formula

a(A163252(n)) = n = A163252(a(n)).

A302846 Interleave the Gray-coded X and Y-coordinates of 2-dimensional Hilbert's curve in alternate bit-positions: a(n) = A000695(A003188(A059253(n))) + 2*A000695(A003188(A059252(n))).

Original entry on oeis.org

0, 1, 3, 2, 10, 8, 9, 11, 15, 13, 12, 14, 6, 7, 5, 4, 20, 22, 23, 21, 17, 16, 18, 19, 27, 26, 24, 25, 29, 31, 30, 28, 60, 62, 63, 61, 57, 56, 58, 59, 51, 50, 48, 49, 53, 55, 54, 52, 36, 37, 39, 38, 46, 44, 45, 47, 43, 41, 40, 42, 34, 35, 33, 32, 160, 162, 163, 161, 165, 164, 166, 167, 175, 174, 172, 173, 169, 171, 170, 168, 136
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2018

Keywords

Comments

Like in binary Gray code A003188, also in this permutation the binary expansions of a(n) and a(n+1) differ always by just a single bit-position, that is, A000120(A003987(a(n),a(n+1))) = 1 for all n >= 0. Here A003987 computes bitwise-XOR of its two arguments.
When composed with A052330 this gives A302781.

Crossrefs

Cf. A302845 (inverse permutation).
Cf. also A003188, A163252, A300838 for other permutations satisfying the same condition.

Programs

  • PARI
    A064706(n) = bitxor(n, n>>2);
    A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A163356(n) = if(!n,n,my(i = (#binary(n)-1)\2, f = 4^i, d = (n\f)%4, r = (n%f)); (((((2+(i%2))^d)%5)-1)*f) + if(3==d,f-1-A163356(r),A057300(A163356(r))));
    A302846(n) = A064706(A163356(n));

Formula

a(n) = A064706(A163356(n)) = A003188(A302844(n)).

A300838 Permutation of nonnegative integers: a(n) = A057300(A003188(n)).

Original entry on oeis.org

0, 2, 3, 1, 9, 11, 10, 8, 12, 14, 15, 13, 5, 7, 6, 4, 36, 38, 39, 37, 45, 47, 46, 44, 40, 42, 43, 41, 33, 35, 34, 32, 48, 50, 51, 49, 57, 59, 58, 56, 60, 62, 63, 61, 53, 55, 54, 52, 20, 22, 23, 21, 29, 31, 30, 28, 24, 26, 27, 25, 17, 19, 18, 16, 144, 146, 147, 145, 153, 155, 154, 152, 156, 158, 159, 157, 149, 151
Offset: 0

Views

Author

Antti Karttunen and Peter Munn, Apr 15 2018

Keywords

Comments

Like in binary Gray code A003188, also in this permutation the binary expansions of a(n) and a(n+1) differ always by just a single bit-position, that is, A000120(A003987(a(n),a(n+1))) = 1 for all n >= 0. Here A003987 computes bitwise-XOR of its two arguments. This is true for any composition P(A003188(n)), where P is a permutation that permutes the bit-positions of binary expansion of n in some way.
When composed with A052330 this gives a divisor-or-multiple permutation similar to A207901 and A302781.

Crossrefs

Cf. A300839 (inverse permutation).
Cf. also A003188, A163252, A302846 for other permutations satisfying the same condition.

Programs

  • PARI
    A003188(n) = bitxor(n, n>>1);
    A057300(n) = { my(t=1, s=0); while(n>0,  if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A300838(n) = A057300(A003188(n));

Formula

a(n) = A057300(A003188(n)).

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).

A257218 Lexicographically earliest sequence of distinct positive integers such that gcd(a(n), a(n-1)) takes no value more than twice.

Original entry on oeis.org

1, 2, 3, 6, 4, 8, 10, 5, 15, 9, 18, 12, 16, 24, 30, 20, 40, 32, 48, 36, 27, 54, 72, 60, 45, 75, 25, 50, 70, 7, 14, 28, 42, 21, 63, 126, 84, 56, 112, 64, 96, 120, 80, 100, 150, 90, 108, 81, 162, 216, 144, 168, 140, 35, 105, 210, 180, 135, 225, 300
Offset: 1

Views

Author

Ivan Neretin, Apr 18 2015

Keywords

Comments

Presumably a(n) is a permutation of the positive integers.
Primes seem to occur in their natural order. 31 appears as a(7060). Primes p >= 37 are not found among the first 10000 terms.
Numbers n such that a(n)=n are 1, 2, 3, 12, 306, ...
A256918(n) = gcd(a(n), a(n+1)); gcd(a(A257120(n)), a(A257120(n)+1)) = gcd(a(A257475(n)), a(A257475(n)-1)) = n. - Reinhard Zumkeller, Apr 25 2015
For p prime: A257122(p)-1 = index of the smallest multiple of p: a(A257122(p)-1) mod p = 0 and a(m) mod p > 0 for m < A257122(p)-1. - Reinhard Zumkeller, Apr 26 2015

Examples

			After a(9)=15, the values 1, 2, 3, 4, 6, and 8 are already used, while 7 is forbidden because gcd(15,7)=1 and that value of GCD has already occurred twice, at (1,2) and (2,3). The minimal value which is neither used not forbidden is 9, so a(10)=9.
		

Crossrefs

Other minimal sequences of distinct positive integers that match some condition imposed on a(n) and a(n-1):
A175498 (differences are unique),
A081145 (absolute differences are unique),
A235262 (bitwise XORs are unique),
A163252 (differ by one bit in binary),
A000027 (GCD=1),
A064413 (GCD>1),
A128280 (sum is a prime),
A034175 (sum is a square),
A175428 (sum is a cube),
A077220 (sum is a triangular number),
A073666 (product plus 1 is a prime),
A081943 (product minus 1 is a prime),
A091569 (product plus 1 is a square),
A100208 (sum of squares is a prime).
Cf. A004526.
Cf. A256918, A257120, A257475, A257478, A257122 (putative inverse).
Cf. also A281978.

Programs

  • Haskell
    import Data.List (delete); import Data.List.Ordered (member)
    a257218 n = a257218_list !! (n-1)
    a257218_list = 1 : f 1 [2..] a004526_list where
       f x zs cds = g zs where
         g (y:ys) | cd `member` cds = y : f y (delete y zs) (delete cd cds)
                  | otherwise       = g ys
                  where cd = gcd x y
    -- Reinhard Zumkeller, Apr 24 2015
  • Mathematica
    a={1}; used=Array[0&,10000]; Do[i=1; While[MemberQ[a,i] || used[[l=GCD[a[[-1]],i]]]>=2, i++]; used[[l]]++; AppendTo[a,i], {n,2,100}]; a (* Ivan Neretin, Apr 18 2015 *)

A303775 Permutation of nonnegative integers: Minimal subset/superset bitmask transform of Blue code, A193231.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 05 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) = A193231(n).
Shares with permutations like A003188, A006068, A163252, A300838, A302846, A303763, A303765, A303767, A303773 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. Note that A303767 is obtained when the same transform is applied to A001477, and A304083 when it is applied to A054429.

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 A193231(h_i) is minimized, which happens to be at 6 (as A193231(6) = 6, but A193231(7) = 7, and for n >= 8, A193231(n) >= 8), thus a(4) = 6.
After a(4) = 6, "110" in binary, the submask "10" (2) is already present in sequence, while submask "100" (4) is only one which is not present, thus 4 is selected to be the value of a(5).
After a(8) = 15, "1111" in binary, none of the submasks "1000" (8), "1001" (9), "1010" (10), "1011" (11), "1100" (12), "1101" (13) or "1110" (14) are present, and as A193231 obtains its minimum value in the range [8 .. 14] at 14 (A193231(14) = 9), we have a(9) = 14.
		

Crossrefs

Cf. A303776 (inverse).
Cf. also A303767, A304083.

Programs

  • PARI
    up_to = (2^18)+2;
    A193231(n) = { my(x='x); subst(lift(Mod(1, 2)*subst(Pol(binary(n), x), x, 1+x)), x, 2) }; \\ From A193231
    v303775 = vector(up_to);
    m303776 = Map();
    find_minimal_submask_for_A193231(n,m_inverses) = { my(minval=0,minmask=0); for(m=1,n,if((bitor(m,n)==n) && !mapisdefined(m_inverses,m) && (!minval || (A193231(m) < minval)), minval = A193231(m); minmask = m)); (minmask); };
    find_minimal_supermask_for_A193231(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 || (A193231(m) < minval)), minval = A193231(m); minmask = m)); (minmask); };
    w=1; for(n=1,up_to,s = Set([]); if((submask = find_minimal_submask_for_A193231(w,m303776)), w = submask, w = find_minimal_supermask_for_A193231(w,m303776)); v303775[n] = w; mapput(m303776,w,n));
    A303775(n) = if(!n,n,v303775[n]);
    A303776(n) = if(!n,n,mapget(m303776,n));

Formula

Derived sequences:
A019565(a(n)) = A303778(n).
A000120(a(n)) = A303780(n).

A294994 Begin with 2; thereafter a(n) is the least prime not already in the sequence such that the Hamming distance between it and the preceding prime is at most 2.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 29, 17, 19, 23, 31, 47, 37, 41, 43, 59, 61, 53, 101, 71, 67, 73, 79, 103, 97, 107, 109, 127, 191, 151, 131, 137, 139, 163, 167, 173, 157, 149, 181, 179, 211, 83, 89, 113, 241, 193, 197, 199, 223, 239, 227, 229, 233, 251, 379, 283, 271, 263, 257, 269, 277, 281, 313, 307, 311, 293
Offset: 1

Views

Author

Robert G. Wilson v, Nov 12 2017

Keywords

Comments

The Hamming distance between two primes p and q is the Hamming distance between their binary expansions. - N. J. A. Sloane, May 27 2018
Conjecture: this sequence is a permutation of the primes.
By definition, the absolute difference of a(n) and a(n + 1) is in A048645. - David A. Corneth, Jan 12 2018

Crossrefs

See also A303593, A303594, A303595 (when n-th prime appears).

Programs

  • Mathematica
    f[s_List] := Block[{p = s[[-1]], q = 3}, While[MemberQ[s, q] || Plus @@ IntegerDigits [BitXor[p, q], 2] > 2, q = NextPrime@q]; Append[s, q]]; s = {2}; Nest[f, s, 65]
  • PARI
    s = 0; v = 2; for (n=1, 66, print1 (v ", "); s += 2^v; forprime (p=2, oo, if (!bittest(s, p) && hammingweight(bitxor(p, v))<=2, v = p; break))) \\ Rémy Sigrist, Jan 08 2018

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).

A298480 Lexicographically earliest sequence of distinct positive terms such that the Fermi-Dirac factorizations of two consecutive terms differ by exactly one factor.

Original entry on oeis.org

1, 2, 6, 3, 12, 4, 8, 24, 120, 30, 10, 5, 15, 60, 20, 40, 280, 56, 14, 7, 21, 42, 168, 84, 28, 140, 35, 70, 210, 105, 420, 840, 7560, 1080, 216, 54, 18, 9, 27, 108, 36, 72, 360, 90, 45, 135, 270, 1890, 378, 126, 63, 189, 756, 252, 504, 1512, 16632, 1848, 264
Offset: 1

Views

Author

Rémy Sigrist, Jul 21 2018

Keywords

Comments

For Fermi-Dirac representation of n see A182979. - N. J. A. Sloane, Jul 21 2018
For any n > 0, either a(n)/a(n+1) or a(n+1)/a(n) belongs to A050376.
This sequence has similarities with A282291; in both sequences, each pair of consecutive terms contains a term that divides the other.

Examples

			The first terms, alongside a(n+1)/a(n), are:
  n   a(n)  a(n+1)/a(n)
  --  ----  -----------
   1     1        2
   2     2        3
   3     6      1/2
   4     3        2^2
   5    12      1/3
   6     4        2
   7     8        3
   8    24        5
   9   120      1/2^2
  10    30      1/3
  11    10      1/2
  12     5        3
  13    15        2^2
  14    60      1/3
  15    20        2
  16    40        7
  17   280      1/5
  18    56      1/2^2
  19    14      1/2
  20     7        3
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

A000120(A052331(a(n)) XOR A052331(a(n+1))) = 1 for any n > 0 (where XOR denotes the bitwise XOR operator).
Apparently, a(n) = A052330(A163252(n-1)) for any n > 0.

A261725 Lexicographically earliest sequence of distinct terms such that the absolute difference of two successive terms is a power of 10, and can be computed without carry.

Original entry on oeis.org

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

Views

Author

Paul Tek, Aug 30 2015

Keywords

Comments

In base 10, two successive terms have the same representation, except for one position, where the digits differ from exactly one unit. This difference can occur on a leading zero.
Conjectured to be a permutation of the nonnegative integers. See A261729 for putative inverse.
a(n) = A003100(n) for n < 101, but a(101) = 180, A003100(101) = 191.
a(n) = A118757(n) for n < 201, but a(201) = 281, A118757(201) = 290.
a(n) = A118758(n) for n < 100, but a(100) = 190, A118758(100) = 109.
a(n) = A174025(n) for n < 100, but a(100) = 190, A174025(100) = 199.
a(n) = A261729(n) for n < 100, but a(100) = 190, A261729(100) = 109.

Crossrefs

Cf. A003100, A118757, A118763, A163252, A261729 (putative inverse).

Programs

  • Perl
    See Links section.
Showing 1-10 of 12 results. Next