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

A329697 a(n) is the number of iterations needed to reach a power of 2 starting at n and using the map k -> k-(k/p), where p is the largest prime factor of k.

Original entry on oeis.org

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

Views

Author

Ali Sada and Robert G. Wilson v, Feb 28 2020

Keywords

Comments

From Antti Karttunen, Apr 07 2020: (Start)
Also the least number of iterations of nondeterministic map k -> k-(k/p) needed to reach a power of 2, when any prime factor p of k can be used. The minimal length path to the nearest power of 2 (= 2^A064415(n)) is realized whenever one uses any of the A005087(k) distinct odd prime factors of the current k, at any step of the process. For example, this could be done by iterating with the map k -> k-(k/A078701(k)), i.e., by using the least odd prime factor of k (instead of the largest prime).
Proof: Viewing the prime factorization of changing k as a multiset ("bag") of primes, we see that liquefying any odd prime p with step p -> (p-1) brings at least one more 2 to the bag, while applying p -> (p-1) to any 2 just removes it from the bag, but gives nothing back. Thus the largest (and thus also the nearest) power of 2 is reached by eliminating - step by step - all odd primes from the bag, but none of 2's, and it doesn't matter in which order this is done.
The above implies also that the sequence is totally additive, which also follows because both A064097 and A064415 are. That A064097(n) = A329697(n) + A054725(n) for all n > 1 can be also seen by comparing the initial conditions and the recursion formulas of these three sequences.
For any n, A333787(n) is either the nearest power of 2 reached (= 2^A064415(n)), or occurs on some of the paths from n to there.
(End)
A003401 gives the numbers k where a(k) = A005087(k). See also A336477. - Antti Karttunen, Mar 16 2021

Examples

			The trajectory of 15 is {12, 8}, taking 2 iterations to reach 8 = 2^3. So a(15) is 2.
From _Antti Karttunen_, Apr 07 2020: (Start)
Considering all possible paths from 15 to 1 nondeterministic map k -> k-(k/p), where p can be any prime factor of k, we obtain the following graph:
        15
       / \
      /   \
    10     12
    / \   / \
   /   \ /   \
  5     8     6
   \__  |  __/|
      \_|_/   |
        4     3
         \   /
          \ /
           2
           |
           1.
It can be seen that there's also alternative route to 8 via 10 (with 10 = 15-(15/3), where 3 is not the largest prime factor of 15), but it's not any shorter than the route via 12.
(End)
		

Crossrefs

Cf. A000079, A334101, A334102, A334103, A334104, A334105, A334106 for positions of 0 .. 6 in this sequence, and also array A334100.
Cf. A334099 (a right inverse, positions of the first occurrence of each n).
Cf. A334091 (first differences), A335429 (partial sums).
Cf. also A331410 (analogous sequence when using the map k -> k + k/p), A334861, A335877 (their sums and differences), see also A335878 and A335884, A335885.

Programs

  • Mathematica
    a[n_] := Length@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, n, # != 2^IntegerExponent[#, 2] &] -1; Array[a, 100]
  • PARI
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1])))); \\ Antti Karttunen, Apr 07 2020
    
  • PARI
    up_to = 2^24;
    A329697list(up_to) = { my(v=vector(up_to)); v[1] = 0; for(n=2, up_to, v[n] = if(!bitand(n,n-1),0,1+vecmin(apply(p -> v[n-n/p], factor(n)[, 1]~)))); (v); };
    v329697 = A329697list(up_to);
    A329697(n) = v329697[n]; \\ Antti Karttunen, Apr 07 2020
    
  • PARI
    A329697(n) = if(n<=2,0, if(isprime(n), A329697(n-1)+1, my(f=factor(n)); (apply(A329697, f[, 1])~ * f[, 2]))); \\ Antti Karttunen, Apr 19 2020

Formula

From Antti Karttunen, Apr 07-19 2020: (Start)
a(1) = a(2) = 0; and for n > 2, a(p) = 1 + a(p-1) if p is an odd prime and a(n*m) = a(n) + a(m) if m,n > 1. [This is otherwise equal to the definition of A064097, except here we have a different initial condition, with a(2) = 0].
a(2n) = a(A000265(n)) = a(n).
a(p) = 1+a(p-1), for all odd primes p.
If A209229(n) == 1 [when n is a power of 2], a(n) = 0,
otherwise a(n) = 1 + a(n-A052126(n)) = 1 + a(A171462(n)).
Equivalently, for non-powers of 2, a(n) = 1 + a(n-(n/A078701(n))),
or equivalently, for non-powers of 2, a(n) = 1 + Min a(n - n/p), for p prime and dividing n.
a(n) = A064097(n) - A064415(n), or equally, a(n) = A064097(n) - A054725(n), for n > 1.
a(A019434(n)) = 1, a(A334092(n)) = 2, a(A334093(n)) = 3, etc. for all applicable n.
For all n >= 0, a(A334099(n)) = a(A000244(n)) = a(A000351(n)) = a(A001026(n)) = a(257^n) = a(65537^n) = n.
a(A122111(n)) = A334107(n), a(A225546(n)) = A334109(n).
(End)
From Antti Karttunen, Mar 16 2021: (Start)
a(n) = a(A336466(n)) + A087436(n) = A336396(n) + A087436(n).
a(A053575(n)) = A336469(n) = a(n) - A005087(n).
a(A147545(n)) = A000120(A147545(n)) - 1.
(End)

A334102 Numbers n for which A329697(n) == 2.

Original entry on oeis.org

7, 9, 11, 13, 14, 15, 18, 22, 25, 26, 28, 30, 36, 41, 44, 50, 51, 52, 56, 60, 72, 82, 85, 88, 97, 100, 102, 104, 112, 120, 137, 144, 164, 170, 176, 193, 194, 200, 204, 208, 224, 240, 274, 288, 289, 328, 340, 352, 386, 388, 400, 408, 416, 448, 480, 548, 576, 578, 641, 656, 680, 704, 769, 771, 772, 776, 800, 816, 832, 896, 960, 1096
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Numbers n for which A171462(n) = n-A052126(n) is in A334101.
Numbers k such that A000265(k) is either in A333788 or in A334092.
Each term is either of the form A334092(n)*2^k, for some n >= 1, and k >= 0, or a product of two terms of A334101, whether distinct or not.
Binary weight (A000120) of these terms is always either 2, 3 or 4. It is 2 for those terms that are of the form 9*2^k, 4 for the terms of the form p*q*2^k, where p and q are two distinct Fermat primes (A019434), and 3 for the both terms of the form A334092(n)*2^k, and for the terms of the form (p^2)*(2^k), where p is a Fermat prime > 3.

Crossrefs

Row 2 of A334100.
Cf. A333788 (a subsequence), A334092 (primes present), A334093 (primes that are 1 + some term in this sequence).
Squares of A334101 form a subsequence of this sequence. Squares of these numbers can be found (as a subset) in A334104, and the cubes in A334106.

Programs

A334101 Numbers of the form q*(2^k), where q is one of the Fermat primes and k >= 0; Numbers n for which A329697(n) == 1.

Original entry on oeis.org

3, 5, 6, 10, 12, 17, 20, 24, 34, 40, 48, 68, 80, 96, 136, 160, 192, 257, 272, 320, 384, 514, 544, 640, 768, 1028, 1088, 1280, 1536, 2056, 2176, 2560, 3072, 4112, 4352, 5120, 6144, 8224, 8704, 10240, 12288, 16448, 17408, 20480, 24576, 32896, 34816, 40960, 49152, 65537, 65792, 69632, 81920, 98304, 131074, 131584, 139264
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Numbers k that themselves are not powers of two, but for which A171462(k) = k-A052126(k) is [a power of 2].
Numbers k such that A000265(k) is in A019434.
Squares of these numbers can be found (as a subset) in A334102, and the cubes (as a subset) in A334103.

Crossrefs

Row 1 of A334100.
Cf. A019434 (primes present), A007283, A020714, A110287 (other subsequences).
Subsequence of A018900.

Programs

Formula

For all n, A000120(a(n)) = 2.

A334103 Numbers n for which A329697(n) == 3.

Original entry on oeis.org

19, 21, 23, 27, 29, 31, 33, 35, 37, 38, 39, 42, 45, 46, 53, 54, 55, 58, 61, 62, 65, 66, 70, 73, 74, 75, 76, 78, 83, 84, 89, 90, 92, 101, 103, 106, 108, 110, 113, 116, 119, 122, 123, 124, 125, 130, 132, 140, 146, 148, 150, 152, 153, 156, 166, 168, 178, 180, 184, 187, 202, 205, 206, 212, 216, 220, 221, 226, 232, 238, 241, 244
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Numbers n for which A171462(n) = n-A052126(n) is in A334102.
Among the first 2821 terms (terms < 2^31), there are terms with binary weights 2, 3, 4, 5, 6 and 8. For example, 33 is the first term with binary weight 2, and 255 is the first term with binary weight 8.

Crossrefs

Row 3 of A334100.
Cf. A334093 (primes present), A334094.

Programs

A334104 Numbers m for which A329697(m) = 4.

Original entry on oeis.org

43, 47, 49, 57, 59, 63, 67, 69, 71, 77, 79, 81, 86, 87, 91, 93, 94, 95, 98, 99, 105, 107, 109, 111, 114, 115, 117, 118, 121, 126, 131, 134, 135, 138, 142, 143, 145, 149, 151, 154, 155, 157, 158, 159, 162, 165, 167, 169, 172, 174, 175, 179, 181, 182, 183, 185, 186, 188, 190, 195, 196, 198, 210, 214, 218, 219, 222, 225
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Comments

Squares of A334102 form a subsequence.
Among the first 12193 terms (terms < 2^31), there are terms with binary weights 2 - 16, except no terms with weight 13, 14 or 15. For example, 1025 is the first term with binary weight 2, and 65535 is the first term with binary weight 16.

Examples

			63 = 7*9 is a term as both 7 and 9 are terms of A334102.
65535 = 3*5*17*257 is a term as it is a product of four Fermat primes, thus in four steps all odd primes can be eliminated with p -> (p-1) map.
		

Crossrefs

Row 4 of A334100.
Cf. A334094 (primes present).

Programs

  • Mathematica
    Position[Array[Length@NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, #, # != 2^IntegerExponent[#, 2] &] - 1 &, 225], 4][[All, 1]] (* Michael De Vlieger, Apr 30 2020 *)
  • PARI
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1]))));
    isA334104(n) = (4==A329697(n));

A334106 Numbers n for which A329697(n) == 6.

Original entry on oeis.org

283, 301, 329, 343, 347, 361, 379, 381, 383, 387, 399, 413, 417, 419, 423, 431, 437, 441, 463, 469, 473, 483, 487, 489, 491, 497, 509, 513, 517, 519, 523, 529, 531, 539, 547, 551, 553, 557, 559, 566, 567, 571, 573, 589, 591, 597, 599, 602, 603, 609, 611, 621, 627, 631, 633, 635, 637, 639, 643, 645, 649, 651, 653, 658, 665
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Crossrefs

Row 6 of A334100.
Cf. A334096 (primes present).

Programs

A334111 Irregular triangle where row n gives all terms k for which A064097(k) = n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Applying map k -> (p-1)*(k/p) to any term k on any row n > 1, where p is any prime factor of k, gives one of the terms on preceding row n-1.
Any prime that appears on row n is 1 + {some term on row n-1}.
The e-th powers of the terms on row n form a subset of terms on row (e*n). More generally, a product of terms that occur on rows i_1, i_2, ..., i_k can be found at row (i_1 + i_2 + ... + i_k), because A064097 is completely additive.
A001221(k) gives the number of terms on the row above that are immediate descendants of k.
A067513(k) gives the number of terms on the row below that lead to k.

Examples

			Rows 0-6 of the irregular table:
0 |   1;
1 |   2;
2 |   3, 4;
3 |   5, 6, 8;
4 |   7, 9, 10, 12, 16;
5 |  11, 13, 14, 15, 17, 18, 20, 24, 32;
6 |  19, 21, 22, 25, 26, 27, 28, 30, 34, 36, 40, 48, 64;
		

Crossrefs

Cf. A105017 (left edge), A000079 (right edge), A175125 (row lengths).
Cf. also A058812, A334100.

Programs

  • Mathematica
    f[n_] := Length@ NestWhileList[# - #/FactorInteger[#][[1, 1]] &, n, # != 1 &]; SortBy[ Range@70, f]
    (* Second program *)
    With[{nn = 8}, Values@ Take[KeySort@ PositionIndex@ Array[-1 + Length@ NestWhileList[# - #/FactorInteger[#][[1, 1]] &, #, # > 1 &] &, 2^nn], nn + 1]] // Flatten (* Michael De Vlieger, Apr 18 2020 *)
  • PARI
    A060681(n) = (n-if(1==n,n,n/vecmin(factor(n)[,1])));
    A064097(n) = if(1==n,0,1+A064097(A060681(n)));
    for(n=0, 10, for(k=1,2^n,if(A064097(k)==n, print1(k,", "))));

A334105 Numbers m for which A329697(m) = 5.

Original entry on oeis.org

127, 129, 133, 139, 141, 147, 161, 163, 171, 173, 177, 189, 191, 197, 199, 201, 203, 207, 209, 211, 213, 215, 217, 223, 229, 231, 235, 237, 243, 245, 247, 253, 254, 258, 259, 261, 263, 266, 269, 271, 273, 277, 278, 279, 282, 285, 294, 295, 297, 299, 311, 315, 317, 319, 321, 322, 326, 327, 331, 333, 335, 341, 342, 345, 346, 349, 351
Offset: 1

Views

Author

Antti Karttunen, Apr 14 2020

Keywords

Examples

			127 = 63*2 + 1 is a term, as 127 is a prime and 63 is in A334104 as A329697(63) = 4.
2^32 -1 = 4294967295 = 3*5*17*257*65537 is a term as it is a product of five Fermat primes, thus in five steps all odd primes can be eliminated with p -> (p-1) map.
Likewise for 1442840405 = 5 * 17 * 257^3. (The first term with binary weight = 24).
		

Crossrefs

Row 5 of A334100.
Cf. A334095 (primes present).

Programs

  • Mathematica
    Position[Array[Length@ NestWhileList[# - #/FactorInteger[#][[-1, 1]] &, #, # != 2^IntegerExponent[#, 2] &] - 1 &, 360], 5][[All, 1]] (* Michael De Vlieger, Apr 30 2020 *)
  • PARI
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1]))));
    isA334105(n) = (5==A329697(n));

A336471 Lexicographically earliest infinite sequence such that a(i) = a(j) => A329697(i) = A329697(j) and A336158(i) = A336158(j), for all i, j >= 1.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 22 2020

Keywords

Comments

Restricted growth sequence transform of the ordered pair [A329697(n), A336158(n)].
For all i, j:
A336470(i) = A336470(j) => a(i) = a(j)
a(i) = a(j) => A336396(i) = A336396(j),
a(i) = a(j) => A336469(i) = A336469(j) => A336477(i) = A336477(j).
This sequence has an ability to see where the terms of A003401 are, as they are the indices of zeros in A336469. Specifically, they are numbers k that satisfy the condition A329697(k) = A001221(A336158(k)), i.e., numbers for which A329697(k) is equal to the number of distinct prime divisors of the odd part of k. See also comments in array A334100.

Crossrefs

Programs

  • PARI
    up_to = 65537;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A000265(n) = (n>>valuation(n,2));
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    A336158(n) = A046523(A000265(n));
    A329697(n) = if(!bitand(n,n-1),0,1+A329697(n-(n/vecmax(factor(n)[, 1]))));
    Aux336471(n) = [A329697(n), A336158(n)];
    v336471 = rgs_transform(vector(up_to, n, Aux336471(n)));
    A336471(n) = v336471[n];

A335430 Square array where row n lists all numbers k for which A331410(k) = n, read by falling antidiagonals.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 7, 9, 15, 16, 12, 10, 17, 25, 32, 14, 11, 19, 29, 73, 64, 24, 13, 27, 37, 75, 125, 128, 28, 18, 30, 45, 85, 145, 365, 256, 31, 20, 33, 50, 87, 149, 375, 625, 512, 48, 21, 34, 51, 89, 173, 425, 725, 1249, 1024, 56, 22, 35, 53, 95, 185, 435, 745, 1489, 3125, 2048, 62, 23, 38, 55, 101, 219, 445, 841, 1825, 3625, 6245
Offset: 0

Views

Author

Antti Karttunen, Jun 28 2020

Keywords

Comments

Array is read by descending antidiagonals with (n,k) = (0,0), (0,1), (1,0), (0,2), (1,1), (2,0), ... where A(n,k) is the (k+1)-th solution x to A331410(x) = n. The row indexing (n) starts from 0, and column indexing (k) also from 0.
For any odd prime p that appears on row n, p+1 appears on row n-1.
The e-th powers of the terms on row n form a subset of terms on row (e*n). More generally, a product of terms that occur on rows i_1, i_2, ..., i_k can be found at row (i_1 + i_2 + ... + i_k), because A331410 is completely additive.

Examples

			The top left corner of the array:
  n\k |    0     1     2     3     4     5     6     7     8     9
------+----------------------------------------------------------------
   0  |    1,    2,    4,    8,   16,   32,   64,  128,  256,  512, ...
   1  |    3,    6,    7,   12,   14,   24,   28,   31,   48,   56, ...
   2  |    5,    9,   10,   11,   13,   18,   20,   21,   22,   23, ...
   3  |   15,   17,   19,   27,   30,   33,   34,   35,   38,   39, ...
   4  |   25,   29,   37,   45,   50,   51,   53,   55,   57,   58, ...
   5  |   73,   75,   85,   87,   89,   95,  101,  109,  111,  113, ...
   6  |  125,  145,  149,  173,  185,  219,  225,  250,  255,  261, ...
   7  |  365,  375,  425,  435,  445,  447,  449,  475,  493,  499, ...
   8  |  625,  725,  745,  841,  865,  925,  997, 1009, 1073, 1095, ...
   9  | 1249, 1489, 1825, 1875, 1993, 2017, 2117, 2125, 2175, 2225, ...
etc.
		

Crossrefs

Cf. A331410.
Cf. A329662 (the leftmost column), A000079, A335431, A335882 (rows 0, 1 and 2).
Cf. also A334100 (an analogous array for the map k -> k - k/p), and A335910.

Programs

  • PARI
    up_to = 78-1; \\ = binomial(12+1,2)-1
    memoA331410 = Map();
    A331410(n) = if(1==n,0,my(v=0); if(mapisdefined(memoA331410,n,&v), v, my(f=factor(n)); v = sum(k=1,#f~,if(2==f[k,1],0,f[k,2]*(1+A331410(f[k,1]+1)))); mapput(memoA331410,n,v); (v)));
    memoA335430sq = Map();
    A335430sq(n, k) = { my(v=0); if((0==k), v = -1, if(!mapisdefined(memoA335430sq,[n,k-1],&v), v = A335430sq(n, k-1))); for(i=1+v,oo,if(A331410(1+i)==n,mapput(memoA335430sq,[n,k],i); return(1+i))); };
    A335430list(up_to) = { my(v = vector(1+up_to), i=0); for(a=0,oo, for(col=0,a, i++; if(i > #v, return(v)); v[i] = A335430sq(col,(a-(col))))); (v); };
    v335430 = A335430list(up_to);
    A335430(n) = v335430[1+n];
    for(n=0,up_to,print1(A335430(n),", "));
Showing 1-10 of 16 results. Next