A307092 a(n) is the minimum number of iterations of the form x -> x + x^j (where j is a nonnegative integer and need not be identical in each iteration) required to reach n starting from 1.
0, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 4, 5, 2, 3, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 3, 4, 5, 6, 2, 3, 3, 4, 4, 5, 4, 5, 3, 4, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, 4, 5, 6, 7, 4, 5, 5, 6, 6, 7, 2, 3, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 3, 4, 5, 6, 6, 7, 5, 6, 7, 8, 8, 9, 6, 7, 7, 8, 7
Offset: 1
Keywords
Examples
For n = 43, a(43) = 4 because we can reach 43 by the four iterations below, but not in less iterations: - 1 -> 2 by setting j=0, 1 + 1^0 = 2, - 2 -> 6 by setting j=2, 2 + 2^2 = 6, - 6 -> 42 by setting j=2, 6 + 6^2 = 42, - 42 -> 43 by setting j=0, 42 + 42^0 = 43. From _Peter Kagey_, Aug 22 2019: (Start) So if there is exactly one creature in the game, running the following four commands will result in 43 creatures in the game: /summon minecraft:cat /execute at @e run execute at @e run summon minecraft:cat /execute at @e run execute at @e run summon minecraft:cat /summon minecraft:cat Which have 0, 2, 2, and 0 nested "execute" commands respectively, and four is the fewest number of commands that can be run to create exactly 43 creatures in the game. (End)
Links
- Peter Kagey, Table of n, a(n) for n = 1..10000
- Ely Golden, Python program for generating terms of this sequence
- Minecraft Wiki, Execute command
Programs
-
Mathematica
(* To get more terms of the sequence, increase terms, maxa and maxx, and then set maxi=trunc(lb(maxx)) *) maxi=16; maxx=65536; maxa=10; terms=100; a = NestList[ Function[list, DeleteDuplicates[ Join[list, Flatten[Table[If[# + #^i <= maxx, # + #^i, 1], {i, 0, maxi}] & /@ list]]]], {1}, maxa]; b = Prepend[Table[Complement[a[[i + 1]], a[[i]]], {i, Length[a] - 1}], First[a]]; c = SparseArray[ Flatten[b] -> Flatten[Table[ ConstantArray[i, Length[b[[i]]]], {i, Length[b]}]]] // Normal; Take[c, terms] - 1
Comments