To exponential digit growth and beyond!
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
$begingroup$
Challenge
Given a base $1 < b < 10$ and an index $t ge 1$, output term $x_t$, defined as follows:
- $x_1 = 11_{10}$
$x_{i+1}$ is obtained by converting $x_i$ to base $b$ and then reinterpreting its digits in base $10$
- Output should be in base $10$
A walk through for base 5, term 5 would be:
$x_1 = 11_{10}$.
$11_{10} = 21_{5}$ so $x_2 = 21_{10}$.
$21_{10} = 41_{5}$ so $x_3 = 41_{10}$.
$41_{10} = 131_{5}$ so $x_4 = 131_{10}$.
$131_{10} = 1011_{5}$ so $x_5 = 1011_{10}$.- We output the string
"1011"
or the integer1011
.
Test Cases
Note: these are one indexed
base 2, term 5 --> 1100100111110011010011100010101000011000101001000100011011011010001111011100010000001000010011100011
base 9, term 70 --> 1202167480887
base 8, term 30 --> 4752456545
base 4, term 13 --> 2123103032103331200023103133211223233322200311320011300320320100312133201303003031113021311200322222332322220300332231220022313031200030333132302313012110123012123010113230200132021023101313232010013102221103203031121232122020233303303303211132313213012222331020133
Notes
- Standard loopholes are not allowed
- Any default I/O method is allowed
- You may use different indexes (such as 0-indexed, 1-indexed, 2-indexed, etc) for $t$
- You may output the first $t$ terms.
- As this is code-golf, shortest code wins for that language
code-golf number
$endgroup$
|
show 1 more comment
$begingroup$
Challenge
Given a base $1 < b < 10$ and an index $t ge 1$, output term $x_t$, defined as follows:
- $x_1 = 11_{10}$
$x_{i+1}$ is obtained by converting $x_i$ to base $b$ and then reinterpreting its digits in base $10$
- Output should be in base $10$
A walk through for base 5, term 5 would be:
$x_1 = 11_{10}$.
$11_{10} = 21_{5}$ so $x_2 = 21_{10}$.
$21_{10} = 41_{5}$ so $x_3 = 41_{10}$.
$41_{10} = 131_{5}$ so $x_4 = 131_{10}$.
$131_{10} = 1011_{5}$ so $x_5 = 1011_{10}$.- We output the string
"1011"
or the integer1011
.
Test Cases
Note: these are one indexed
base 2, term 5 --> 1100100111110011010011100010101000011000101001000100011011011010001111011100010000001000010011100011
base 9, term 70 --> 1202167480887
base 8, term 30 --> 4752456545
base 4, term 13 --> 2123103032103331200023103133211223233322200311320011300320320100312133201303003031113021311200322222332322220300332231220022313031200030333132302313012110123012123010113230200132021023101313232010013102221103203031121232122020233303303303211132313213012222331020133
Notes
- Standard loopholes are not allowed
- Any default I/O method is allowed
- You may use different indexes (such as 0-indexed, 1-indexed, 2-indexed, etc) for $t$
- You may output the first $t$ terms.
- As this is code-golf, shortest code wins for that language
code-golf number
$endgroup$
1
$begingroup$
Do we have to support larger numbers or just numbers up to 2^31 - 1?
$endgroup$
– Embodiment of Ignorance
May 19 at 23:39
1
$begingroup$
@EmbodimentofIgnorance The maximum of your language (Remember the standard loophole, though!)
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Is there a challenge that includes bases > 10? (In that case you would repeatedly interpret11
as if it was in baseb
and convert it back to base 10, etc.)
$endgroup$
– Neil
May 21 at 11:11
$begingroup$
@Neil I didn't include bases higher than 10 since (for example)4a
wouldn't be a valid number in base-10
$endgroup$
– MilkyWay90
May 22 at 22:49
$begingroup$
You wouldn't get4a
, since you'd be interpreting the base 10 digits as baseb
and converting to base 10 each time (i.e. the other way around from this question).
$endgroup$
– Neil
May 22 at 22:59
|
show 1 more comment
$begingroup$
Challenge
Given a base $1 < b < 10$ and an index $t ge 1$, output term $x_t$, defined as follows:
- $x_1 = 11_{10}$
$x_{i+1}$ is obtained by converting $x_i$ to base $b$ and then reinterpreting its digits in base $10$
- Output should be in base $10$
A walk through for base 5, term 5 would be:
$x_1 = 11_{10}$.
$11_{10} = 21_{5}$ so $x_2 = 21_{10}$.
$21_{10} = 41_{5}$ so $x_3 = 41_{10}$.
$41_{10} = 131_{5}$ so $x_4 = 131_{10}$.
$131_{10} = 1011_{5}$ so $x_5 = 1011_{10}$.- We output the string
"1011"
or the integer1011
.
Test Cases
Note: these are one indexed
base 2, term 5 --> 1100100111110011010011100010101000011000101001000100011011011010001111011100010000001000010011100011
base 9, term 70 --> 1202167480887
base 8, term 30 --> 4752456545
base 4, term 13 --> 2123103032103331200023103133211223233322200311320011300320320100312133201303003031113021311200322222332322220300332231220022313031200030333132302313012110123012123010113230200132021023101313232010013102221103203031121232122020233303303303211132313213012222331020133
Notes
- Standard loopholes are not allowed
- Any default I/O method is allowed
- You may use different indexes (such as 0-indexed, 1-indexed, 2-indexed, etc) for $t$
- You may output the first $t$ terms.
- As this is code-golf, shortest code wins for that language
code-golf number
$endgroup$
Challenge
Given a base $1 < b < 10$ and an index $t ge 1$, output term $x_t$, defined as follows:
- $x_1 = 11_{10}$
$x_{i+1}$ is obtained by converting $x_i$ to base $b$ and then reinterpreting its digits in base $10$
- Output should be in base $10$
A walk through for base 5, term 5 would be:
$x_1 = 11_{10}$.
$11_{10} = 21_{5}$ so $x_2 = 21_{10}$.
$21_{10} = 41_{5}$ so $x_3 = 41_{10}$.
$41_{10} = 131_{5}$ so $x_4 = 131_{10}$.
$131_{10} = 1011_{5}$ so $x_5 = 1011_{10}$.- We output the string
"1011"
or the integer1011
.
Test Cases
Note: these are one indexed
base 2, term 5 --> 1100100111110011010011100010101000011000101001000100011011011010001111011100010000001000010011100011
base 9, term 70 --> 1202167480887
base 8, term 30 --> 4752456545
base 4, term 13 --> 2123103032103331200023103133211223233322200311320011300320320100312133201303003031113021311200322222332322220300332231220022313031200030333132302313012110123012123010113230200132021023101313232010013102221103203031121232122020233303303303211132313213012222331020133
Notes
- Standard loopholes are not allowed
- Any default I/O method is allowed
- You may use different indexes (such as 0-indexed, 1-indexed, 2-indexed, etc) for $t$
- You may output the first $t$ terms.
- As this is code-golf, shortest code wins for that language
code-golf number
code-golf number
edited May 19 at 23:42
MilkyWay90
asked May 19 at 23:13
MilkyWay90MilkyWay90
1,4321 gold badge5 silver badges26 bronze badges
1,4321 gold badge5 silver badges26 bronze badges
1
$begingroup$
Do we have to support larger numbers or just numbers up to 2^31 - 1?
$endgroup$
– Embodiment of Ignorance
May 19 at 23:39
1
$begingroup$
@EmbodimentofIgnorance The maximum of your language (Remember the standard loophole, though!)
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Is there a challenge that includes bases > 10? (In that case you would repeatedly interpret11
as if it was in baseb
and convert it back to base 10, etc.)
$endgroup$
– Neil
May 21 at 11:11
$begingroup$
@Neil I didn't include bases higher than 10 since (for example)4a
wouldn't be a valid number in base-10
$endgroup$
– MilkyWay90
May 22 at 22:49
$begingroup$
You wouldn't get4a
, since you'd be interpreting the base 10 digits as baseb
and converting to base 10 each time (i.e. the other way around from this question).
$endgroup$
– Neil
May 22 at 22:59
|
show 1 more comment
1
$begingroup$
Do we have to support larger numbers or just numbers up to 2^31 - 1?
$endgroup$
– Embodiment of Ignorance
May 19 at 23:39
1
$begingroup$
@EmbodimentofIgnorance The maximum of your language (Remember the standard loophole, though!)
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Is there a challenge that includes bases > 10? (In that case you would repeatedly interpret11
as if it was in baseb
and convert it back to base 10, etc.)
$endgroup$
– Neil
May 21 at 11:11
$begingroup$
@Neil I didn't include bases higher than 10 since (for example)4a
wouldn't be a valid number in base-10
$endgroup$
– MilkyWay90
May 22 at 22:49
$begingroup$
You wouldn't get4a
, since you'd be interpreting the base 10 digits as baseb
and converting to base 10 each time (i.e. the other way around from this question).
$endgroup$
– Neil
May 22 at 22:59
1
1
$begingroup$
Do we have to support larger numbers or just numbers up to 2^31 - 1?
$endgroup$
– Embodiment of Ignorance
May 19 at 23:39
$begingroup$
Do we have to support larger numbers or just numbers up to 2^31 - 1?
$endgroup$
– Embodiment of Ignorance
May 19 at 23:39
1
1
$begingroup$
@EmbodimentofIgnorance The maximum of your language (Remember the standard loophole, though!)
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
@EmbodimentofIgnorance The maximum of your language (Remember the standard loophole, though!)
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Is there a challenge that includes bases > 10? (In that case you would repeatedly interpret
11
as if it was in base b
and convert it back to base 10, etc.)$endgroup$
– Neil
May 21 at 11:11
$begingroup$
Is there a challenge that includes bases > 10? (In that case you would repeatedly interpret
11
as if it was in base b
and convert it back to base 10, etc.)$endgroup$
– Neil
May 21 at 11:11
$begingroup$
@Neil I didn't include bases higher than 10 since (for example)
4a
wouldn't be a valid number in base-10$endgroup$
– MilkyWay90
May 22 at 22:49
$begingroup$
@Neil I didn't include bases higher than 10 since (for example)
4a
wouldn't be a valid number in base-10$endgroup$
– MilkyWay90
May 22 at 22:49
$begingroup$
You wouldn't get
4a
, since you'd be interpreting the base 10 digits as base b
and converting to base 10 each time (i.e. the other way around from this question).$endgroup$
– Neil
May 22 at 22:59
$begingroup$
You wouldn't get
4a
, since you'd be interpreting the base 10 digits as base b
and converting to base 10 each time (i.e. the other way around from this question).$endgroup$
– Neil
May 22 at 22:59
|
show 1 more comment
22 Answers
22
active
oldest
votes
$begingroup$
JavaScript (Node.js), 40 bytes
Thanks to @Neil for saving 5 bytes on this version and 2 bytes on the BigInt version
Takes input as (t)(base)
, where $t$ is 1-indexed.
n=>g=(b,x=11)=>--n?g(b,+x.toString(b)):x
Try it online!
JavaScript (Node.js), 48 bytes (BigInt version)
Takes input as (t)(base)
, where $t$ is 1-indexed. Returns a BigInt.
n=>g=(b,x=11n)=>--n?g(b,BigInt(x.toString(b))):x
Try it online!
$endgroup$
$begingroup$
Do you need toeval
in the first version?+
would save 5 bytes...
$endgroup$
– Neil
May 20 at 0:36
$begingroup$
AndBigInt
saves two bytes in the second version, because you don't need to addn
to the string.
$endgroup$
– Neil
May 20 at 0:37
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter
$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prependf=
(since the function is referencing itself).
$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Arnauld, oops. Then this onen=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If callf(t)(b)()
is allowed.
$endgroup$
– Qwertiy
May 25 at 22:07
|
show 1 more comment
$begingroup$
05AB1E, 5 bytes
>IF¹B
Try it online!
Explanation
> # increment <base>
IF # <term> times do:
¹B # convert from base-10 to base-<base>
Note that there is no need to explicitly start the sequence at 11.
Starting at base+1
and doing an extra iteration will result in the first iteration giving 11.
$endgroup$
add a comment |
$begingroup$
Japt, 9 bytes
ÆB=sV n
B
Try it
(Two inputs, U and V)
Æ Range [0..U)
B= For each, set B (B is preinitialized to 11) to
sV B's previous value converted to base-V
n and back to base-10
B Print out B's final value
$endgroup$
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
add a comment |
$begingroup$
Wolfram Language (Mathematica), 46 bytes
bNest[FromDigits[#~IntegerDigits~b]&,11,#]&
Try it online!
Call with f[base][t]
. 0-indexed.
$endgroup$
1
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
add a comment |
$begingroup$
Retina, 67 bytes
.+,(d+)
11,$1*
"$+"{`^d+
*
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
,_+
Try it online! Takes comma-separated inputs $t$ (0-indexed) and $b$. Does all of its calculations in unary so times out for large numbers. Explanation:
.+,(d+)
11,$1*
Initialise $x_0=11$ and convert $b$ to unary.
"$+"{`
Repeat $t$ times.
^d+
*
Convert $x_i$ to unary.
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
Convert to base $b$.
,_+
Delete $b$ from the output.
$endgroup$
add a comment |
$begingroup$
Python 2, 71 bytes
def f(b,n):h=lambda x:x and x%b+10*h(x/b);return n and h(f(b,n-1))or 11
Try it online!
0-indexed.
$endgroup$
add a comment |
$begingroup$
Clojure, 109 bytes
Credit to MilkyWay90 for removing 10 bytes by spotting unnecessary spaces
Credit to Embodiment of Ignorance for another byte from another unnecessary space
Golfed
(defn f([b t](f b t 11))([b t v](if(= t 1)v(f b(dec t)(read-string(.(new BigInteger(str v))(toString b)))))))
Ungolfed
(defn f
([base term] (f base term 11))
([base term value] (if (= term 1)
value
(f base (dec term) (read-string (. (new BigInteger (str value)) (toString base)))))))
I think the main place bytes could be saved is the expression for... reradixing? whatever that would be called. Specifically:
(read-string (. (new BigInteger (str value)) (toString base)))
$endgroup$
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
There is still an unnecessary space in(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
add a comment |
$begingroup$
Perl 6, 28 bytes
{(11,+*.base($^b)...*)[$^t]}
Try it online!
The index into the sequence is zero-based.
$endgroup$
add a comment |
$begingroup$
Jelly, 8 7 bytes
‘b³Ḍ$⁴¡
Try it online!
A full program that takes $b$ as first argument and 1-indexed $t$ as its second argument. Returns the integer for the relevant term (and implicitly prints). Uses the observation by @Emigna regarding starting with $b + 1$.
Explanation
‘b³Ḍ$⁴¡ | Main link: first argument b, second argument t
‘ | b + 1
$⁴¡ | Repeat the following t times
b³ | Convert to base b
Ḍ | Convert back from decimal to integer
$endgroup$
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
add a comment |
$begingroup$
K (ngn/k), 13 bytes
{y(10/x)/11}
Try it online!
$endgroup$
add a comment |
$begingroup$
Pyth, 8 bytes
uijGQTEh
Try it online!
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 87 bytes
n=>m=>{int g=11;for(var s="";m-->0;g=int.Parse(s),s="")for(;g>0;g/=n)s=g%n+s;return g;}
Saved 5 bytes thanks to @KevinCruijssen
Try it online!
$endgroup$
$begingroup$
87 bytes by changing thedo-while
into a regular for-loop.
$endgroup$
– Kevin Cruijssen
May 20 at 9:52
add a comment |
$begingroup$
brainfuck, 270 bytes
++<<++<,+++<-[----->-<]<,,[<-----[->++++++++++<]++>[-<+>],]<[>>>>>>[<<<[->>+<<]>>>>>]<<[[>+<-]>>[-[<++++++++++>-]>+>]<[<<]>>[-<<+>>>+<]>>[-[<-[>>+>>]>>[+[-<<+>>]>[-<]<[>]>++>>>]<<<<<-]+>[-<+<+>>]<<[->>+<<]>>>]<[-]<[[-<+>]<<]<]<[->>+<<]<-]>>>>[>>]<<[>-[-----<+>]<----.<<]
Try it online!
0-indexed. The number of iterations is assumed to be at most 255.
Explanation
The tape is laid out as follows:
num_iterations 0 0 base digit0 0 digit1 0 digit2 ...
Each digit is actually stored as that digit plus 1, with 0 reserved for "no more digits". During the base conversion, the digits currently being worked on are moved one cell to the right, and the base is moved to the left of the current working area.
++<<++ Initialize initial value 11
<,+++<-[----->-<] Get single digit as base and subtract 48 to get actual number
<,,[<-----[->++++++++++<]++>[-<+>],] Read multiple digits as number of iterations
< Go to cell containing number of iterations
[ For each iteration:
>>>>>> Go to tens digit cell
[<<<[->>+<<]>>>>>] Move base to just before most significant digit
<< Return to most significant digit
[ For each digit in number starting at the left (right on tape):
[>+<-] Move digit one cell to right (to tell where current digit is later)
>>[-[<++++++++++>-]>+>] Multiply each other digit by 10 and move left
<[<<]>> Return to base
[-<<+>>>+<] Copy base to just before digit (again) and just before next digit to right (left on tape)
>>[ For each digit at least as significant as this digit:
-[<-[>>+>>]>>[+[-<<+>>] Compute "digit" divmod base
>[-<]<[>]>++ While computing this: add quotient to next digit; initialize digit to "1" (0) first if "0" (null)
>>>]<<<<<-] End of divmod routine
+>[-<+<+>>] Leave modulo as current digit and restore base
<<[->>+<<] Move base to next position
>>>
]
<[-]< Delete (now useless) copy of base
[[-<+>]<<]< Move digits back to original cells
] Repeat entire routine for each digit
<[->>+<<] Move base to original position
<- Decrement iteration count
]
>>>>[>>]<<[>-[-----<+>]<----.<<] Output by adding 47 to each cell containing a digit
$endgroup$
add a comment |
$begingroup$
Charcoal, 14 bytes
≔11ζFN≔⍘IζIηζζ
Try it online! Link is to verbose version of code. Takes inputs as $t$ (0-indexed) and $b$. Explanation:
≔11ζ
$x_0=11$.
FN
Loop $b$ times.
≔⍘IζIηζ
Calculate $x_i$.
ζ
Output $x_t$.
$endgroup$
add a comment |
$begingroup$
Pari/GP, 50 bytes
(b,n)->x=11;for(i=2,n,x=fromdigits(digits(x,b)));x
Try it online!
$endgroup$
add a comment |
$begingroup$
C (gcc), 59 bytes
f(t,b){t=t?c(f(t-1,b),b):11;}c(n,b){n=n?c(n/b,b)*10+n%b:0;}
Try it online!
$endgroup$
add a comment |
$begingroup$
Groovy, 45 bytes
a,b,c=11->a--?f(a,b,a.toString(c as int,b)):c
Try it online!
Port of @Arnauld's answer
$endgroup$
add a comment |
$begingroup$
PHP, 83 75 bytes
function c($b,$t,$v=11){return $t==1?$v:c($b,$t-1,base_convert($v,10,$b));}
Try it online!
This one will only work work with "small" numbers (e.g. not test cases 1 and 4)
$endgroup$
add a comment |
$begingroup$
Japt, 10 bytes
0-indexed. Takes t
as the first input, b
as the second.
_ìV ì}gBìC
Try it
$endgroup$
add a comment |
$begingroup$
Gaia, 8 bytes
Bd
11@↑ₓ
Try it online!
Takes 0-based iterations
then base
.
Bd | helper function: convert to Base b (implicit) then convert to base 10
| main function:
11 | push 11
@ | push # of iterations
↑ₓ | do the above function (helper function) that many times as a monad
$endgroup$
add a comment |
$begingroup$
Ruby, 39 bytes
Zero-indexed.
->b,n,x=11{n.times{x=x.to_s(b).to_i};x}
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -Mbigint -pa
, 65 bytes
$=11;map{$p=$;$%=0+"@F";$=($p%"@F").$while$p/=0+"@F"}2..<>}{
Try it online!
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "200"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f185816%2fto-exponential-digit-growth-and-beyond%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
22 Answers
22
active
oldest
votes
22 Answers
22
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
JavaScript (Node.js), 40 bytes
Thanks to @Neil for saving 5 bytes on this version and 2 bytes on the BigInt version
Takes input as (t)(base)
, where $t$ is 1-indexed.
n=>g=(b,x=11)=>--n?g(b,+x.toString(b)):x
Try it online!
JavaScript (Node.js), 48 bytes (BigInt version)
Takes input as (t)(base)
, where $t$ is 1-indexed. Returns a BigInt.
n=>g=(b,x=11n)=>--n?g(b,BigInt(x.toString(b))):x
Try it online!
$endgroup$
$begingroup$
Do you need toeval
in the first version?+
would save 5 bytes...
$endgroup$
– Neil
May 20 at 0:36
$begingroup$
AndBigInt
saves two bytes in the second version, because you don't need to addn
to the string.
$endgroup$
– Neil
May 20 at 0:37
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter
$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prependf=
(since the function is referencing itself).
$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Arnauld, oops. Then this onen=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If callf(t)(b)()
is allowed.
$endgroup$
– Qwertiy
May 25 at 22:07
|
show 1 more comment
$begingroup$
JavaScript (Node.js), 40 bytes
Thanks to @Neil for saving 5 bytes on this version and 2 bytes on the BigInt version
Takes input as (t)(base)
, where $t$ is 1-indexed.
n=>g=(b,x=11)=>--n?g(b,+x.toString(b)):x
Try it online!
JavaScript (Node.js), 48 bytes (BigInt version)
Takes input as (t)(base)
, where $t$ is 1-indexed. Returns a BigInt.
n=>g=(b,x=11n)=>--n?g(b,BigInt(x.toString(b))):x
Try it online!
$endgroup$
$begingroup$
Do you need toeval
in the first version?+
would save 5 bytes...
$endgroup$
– Neil
May 20 at 0:36
$begingroup$
AndBigInt
saves two bytes in the second version, because you don't need to addn
to the string.
$endgroup$
– Neil
May 20 at 0:37
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter
$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prependf=
(since the function is referencing itself).
$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Arnauld, oops. Then this onen=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If callf(t)(b)()
is allowed.
$endgroup$
– Qwertiy
May 25 at 22:07
|
show 1 more comment
$begingroup$
JavaScript (Node.js), 40 bytes
Thanks to @Neil for saving 5 bytes on this version and 2 bytes on the BigInt version
Takes input as (t)(base)
, where $t$ is 1-indexed.
n=>g=(b,x=11)=>--n?g(b,+x.toString(b)):x
Try it online!
JavaScript (Node.js), 48 bytes (BigInt version)
Takes input as (t)(base)
, where $t$ is 1-indexed. Returns a BigInt.
n=>g=(b,x=11n)=>--n?g(b,BigInt(x.toString(b))):x
Try it online!
$endgroup$
JavaScript (Node.js), 40 bytes
Thanks to @Neil for saving 5 bytes on this version and 2 bytes on the BigInt version
Takes input as (t)(base)
, where $t$ is 1-indexed.
n=>g=(b,x=11)=>--n?g(b,+x.toString(b)):x
Try it online!
JavaScript (Node.js), 48 bytes (BigInt version)
Takes input as (t)(base)
, where $t$ is 1-indexed. Returns a BigInt.
n=>g=(b,x=11n)=>--n?g(b,BigInt(x.toString(b))):x
Try it online!
edited May 20 at 11:34
answered May 19 at 23:25
ArnauldArnauld
89.2k7 gold badges103 silver badges365 bronze badges
89.2k7 gold badges103 silver badges365 bronze badges
$begingroup$
Do you need toeval
in the first version?+
would save 5 bytes...
$endgroup$
– Neil
May 20 at 0:36
$begingroup$
AndBigInt
saves two bytes in the second version, because you don't need to addn
to the string.
$endgroup$
– Neil
May 20 at 0:37
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter
$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prependf=
(since the function is referencing itself).
$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Arnauld, oops. Then this onen=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If callf(t)(b)()
is allowed.
$endgroup$
– Qwertiy
May 25 at 22:07
|
show 1 more comment
$begingroup$
Do you need toeval
in the first version?+
would save 5 bytes...
$endgroup$
– Neil
May 20 at 0:36
$begingroup$
AndBigInt
saves two bytes in the second version, because you don't need to addn
to the string.
$endgroup$
– Neil
May 20 at 0:37
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter
$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prependf=
(since the function is referencing itself).
$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Arnauld, oops. Then this onen=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If callf(t)(b)()
is allowed.
$endgroup$
– Qwertiy
May 25 at 22:07
$begingroup$
Do you need to
eval
in the first version? +
would save 5 bytes...$endgroup$
– Neil
May 20 at 0:36
$begingroup$
Do you need to
eval
in the first version? +
would save 5 bytes...$endgroup$
– Neil
May 20 at 0:36
$begingroup$
And
BigInt
saves two bytes in the second version, because you don't need to add n
to the string.$endgroup$
– Neil
May 20 at 0:37
$begingroup$
And
BigInt
saves two bytes in the second version, because you don't need to add n
to the string.$endgroup$
– Neil
May 20 at 0:37
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
(b,t,x=11)=>--t?f(b,t,+x.toString(b)):x
is 1 char shorter$endgroup$
– Qwertiy
May 25 at 21:45
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prepend
f=
(since the function is referencing itself).$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Qwertiy It's actually 1 byte longer, because we'd need to prepend
f=
(since the function is referencing itself).$endgroup$
– Arnauld
May 25 at 22:04
$begingroup$
@Arnauld, oops. Then this one
n=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If call f(t)(b)()
is allowed.$endgroup$
– Qwertiy
May 25 at 22:07
$begingroup$
@Arnauld, oops. Then this one
n=>b=>g=(x=11n)=>--n?g(BigInt(x.toString(b))):x
:) If call f(t)(b)()
is allowed.$endgroup$
– Qwertiy
May 25 at 22:07
|
show 1 more comment
$begingroup$
05AB1E, 5 bytes
>IF¹B
Try it online!
Explanation
> # increment <base>
IF # <term> times do:
¹B # convert from base-10 to base-<base>
Note that there is no need to explicitly start the sequence at 11.
Starting at base+1
and doing an extra iteration will result in the first iteration giving 11.
$endgroup$
add a comment |
$begingroup$
05AB1E, 5 bytes
>IF¹B
Try it online!
Explanation
> # increment <base>
IF # <term> times do:
¹B # convert from base-10 to base-<base>
Note that there is no need to explicitly start the sequence at 11.
Starting at base+1
and doing an extra iteration will result in the first iteration giving 11.
$endgroup$
add a comment |
$begingroup$
05AB1E, 5 bytes
>IF¹B
Try it online!
Explanation
> # increment <base>
IF # <term> times do:
¹B # convert from base-10 to base-<base>
Note that there is no need to explicitly start the sequence at 11.
Starting at base+1
and doing an extra iteration will result in the first iteration giving 11.
$endgroup$
05AB1E, 5 bytes
>IF¹B
Try it online!
Explanation
> # increment <base>
IF # <term> times do:
¹B # convert from base-10 to base-<base>
Note that there is no need to explicitly start the sequence at 11.
Starting at base+1
and doing an extra iteration will result in the first iteration giving 11.
edited May 20 at 6:26
answered May 20 at 6:15
EmignaEmigna
50.3k5 gold badges37 silver badges153 bronze badges
50.3k5 gold badges37 silver badges153 bronze badges
add a comment |
add a comment |
$begingroup$
Japt, 9 bytes
ÆB=sV n
B
Try it
(Two inputs, U and V)
Æ Range [0..U)
B= For each, set B (B is preinitialized to 11) to
sV B's previous value converted to base-V
n and back to base-10
B Print out B's final value
$endgroup$
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
add a comment |
$begingroup$
Japt, 9 bytes
ÆB=sV n
B
Try it
(Two inputs, U and V)
Æ Range [0..U)
B= For each, set B (B is preinitialized to 11) to
sV B's previous value converted to base-V
n and back to base-10
B Print out B's final value
$endgroup$
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
add a comment |
$begingroup$
Japt, 9 bytes
ÆB=sV n
B
Try it
(Two inputs, U and V)
Æ Range [0..U)
B= For each, set B (B is preinitialized to 11) to
sV B's previous value converted to base-V
n and back to base-10
B Print out B's final value
$endgroup$
Japt, 9 bytes
ÆB=sV n
B
Try it
(Two inputs, U and V)
Æ Range [0..U)
B= For each, set B (B is preinitialized to 11) to
sV B's previous value converted to base-V
n and back to base-10
B Print out B's final value
edited May 20 at 21:57
answered May 20 at 2:02
Embodiment of IgnoranceEmbodiment of Ignorance
4,5761 silver badge28 bronze badges
4,5761 silver badge28 bronze badges
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
add a comment |
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
This will never be able to output the first term, will it?
$endgroup$
– Shaggy
May 20 at 7:14
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
@Shaggy Fixed at the cost of two bytes
$endgroup$
– Embodiment of Ignorance
May 20 at 21:57
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
$begingroup$
Nicely saved :) Wouldn't have thought of doing that meself.
$endgroup$
– Shaggy
May 21 at 22:25
add a comment |
$begingroup$
Wolfram Language (Mathematica), 46 bytes
bNest[FromDigits[#~IntegerDigits~b]&,11,#]&
Try it online!
Call with f[base][t]
. 0-indexed.
$endgroup$
1
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
add a comment |
$begingroup$
Wolfram Language (Mathematica), 46 bytes
bNest[FromDigits[#~IntegerDigits~b]&,11,#]&
Try it online!
Call with f[base][t]
. 0-indexed.
$endgroup$
1
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
add a comment |
$begingroup$
Wolfram Language (Mathematica), 46 bytes
bNest[FromDigits[#~IntegerDigits~b]&,11,#]&
Try it online!
Call with f[base][t]
. 0-indexed.
$endgroup$
Wolfram Language (Mathematica), 46 bytes
bNest[FromDigits[#~IntegerDigits~b]&,11,#]&
Try it online!
Call with f[base][t]
. 0-indexed.
answered May 19 at 23:33
attinatattinat
1,7672 silver badges9 bronze badges
1,7672 silver badges9 bronze badges
1
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
add a comment |
1
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
1
1
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
$begingroup$
41 bytes
$endgroup$
– Expired Data
May 20 at 8:37
add a comment |
$begingroup$
Retina, 67 bytes
.+,(d+)
11,$1*
"$+"{`^d+
*
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
,_+
Try it online! Takes comma-separated inputs $t$ (0-indexed) and $b$. Does all of its calculations in unary so times out for large numbers. Explanation:
.+,(d+)
11,$1*
Initialise $x_0=11$ and convert $b$ to unary.
"$+"{`
Repeat $t$ times.
^d+
*
Convert $x_i$ to unary.
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
Convert to base $b$.
,_+
Delete $b$ from the output.
$endgroup$
add a comment |
$begingroup$
Retina, 67 bytes
.+,(d+)
11,$1*
"$+"{`^d+
*
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
,_+
Try it online! Takes comma-separated inputs $t$ (0-indexed) and $b$. Does all of its calculations in unary so times out for large numbers. Explanation:
.+,(d+)
11,$1*
Initialise $x_0=11$ and convert $b$ to unary.
"$+"{`
Repeat $t$ times.
^d+
*
Convert $x_i$ to unary.
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
Convert to base $b$.
,_+
Delete $b$ from the output.
$endgroup$
add a comment |
$begingroup$
Retina, 67 bytes
.+,(d+)
11,$1*
"$+"{`^d+
*
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
,_+
Try it online! Takes comma-separated inputs $t$ (0-indexed) and $b$. Does all of its calculations in unary so times out for large numbers. Explanation:
.+,(d+)
11,$1*
Initialise $x_0=11$ and convert $b$ to unary.
"$+"{`
Repeat $t$ times.
^d+
*
Convert $x_i$ to unary.
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
Convert to base $b$.
,_+
Delete $b$ from the output.
$endgroup$
Retina, 67 bytes
.+,(d+)
11,$1*
"$+"{`^d+
*
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
,_+
Try it online! Takes comma-separated inputs $t$ (0-indexed) and $b$. Does all of its calculations in unary so times out for large numbers. Explanation:
.+,(d+)
11,$1*
Initialise $x_0=11$ and convert $b$ to unary.
"$+"{`
Repeat $t$ times.
^d+
*
Convert $x_i$ to unary.
)+`(?=_.*,(_+))(1)*(_*)
$#2*_$.3
Convert to base $b$.
,_+
Delete $b$ from the output.
answered May 20 at 1:02
NeilNeil
86.7k8 gold badges46 silver badges183 bronze badges
86.7k8 gold badges46 silver badges183 bronze badges
add a comment |
add a comment |
$begingroup$
Python 2, 71 bytes
def f(b,n):h=lambda x:x and x%b+10*h(x/b);return n and h(f(b,n-1))or 11
Try it online!
0-indexed.
$endgroup$
add a comment |
$begingroup$
Python 2, 71 bytes
def f(b,n):h=lambda x:x and x%b+10*h(x/b);return n and h(f(b,n-1))or 11
Try it online!
0-indexed.
$endgroup$
add a comment |
$begingroup$
Python 2, 71 bytes
def f(b,n):h=lambda x:x and x%b+10*h(x/b);return n and h(f(b,n-1))or 11
Try it online!
0-indexed.
$endgroup$
Python 2, 71 bytes
def f(b,n):h=lambda x:x and x%b+10*h(x/b);return n and h(f(b,n-1))or 11
Try it online!
0-indexed.
edited May 20 at 1:03
answered May 20 at 0:51
Chas BrownChas Brown
5,9791 gold badge6 silver badges23 bronze badges
5,9791 gold badge6 silver badges23 bronze badges
add a comment |
add a comment |
$begingroup$
Clojure, 109 bytes
Credit to MilkyWay90 for removing 10 bytes by spotting unnecessary spaces
Credit to Embodiment of Ignorance for another byte from another unnecessary space
Golfed
(defn f([b t](f b t 11))([b t v](if(= t 1)v(f b(dec t)(read-string(.(new BigInteger(str v))(toString b)))))))
Ungolfed
(defn f
([base term] (f base term 11))
([base term value] (if (= term 1)
value
(f base (dec term) (read-string (. (new BigInteger (str value)) (toString base)))))))
I think the main place bytes could be saved is the expression for... reradixing? whatever that would be called. Specifically:
(read-string (. (new BigInteger (str value)) (toString base)))
$endgroup$
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
There is still an unnecessary space in(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
add a comment |
$begingroup$
Clojure, 109 bytes
Credit to MilkyWay90 for removing 10 bytes by spotting unnecessary spaces
Credit to Embodiment of Ignorance for another byte from another unnecessary space
Golfed
(defn f([b t](f b t 11))([b t v](if(= t 1)v(f b(dec t)(read-string(.(new BigInteger(str v))(toString b)))))))
Ungolfed
(defn f
([base term] (f base term 11))
([base term value] (if (= term 1)
value
(f base (dec term) (read-string (. (new BigInteger (str value)) (toString base)))))))
I think the main place bytes could be saved is the expression for... reradixing? whatever that would be called. Specifically:
(read-string (. (new BigInteger (str value)) (toString base)))
$endgroup$
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
There is still an unnecessary space in(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
add a comment |
$begingroup$
Clojure, 109 bytes
Credit to MilkyWay90 for removing 10 bytes by spotting unnecessary spaces
Credit to Embodiment of Ignorance for another byte from another unnecessary space
Golfed
(defn f([b t](f b t 11))([b t v](if(= t 1)v(f b(dec t)(read-string(.(new BigInteger(str v))(toString b)))))))
Ungolfed
(defn f
([base term] (f base term 11))
([base term value] (if (= term 1)
value
(f base (dec term) (read-string (. (new BigInteger (str value)) (toString base)))))))
I think the main place bytes could be saved is the expression for... reradixing? whatever that would be called. Specifically:
(read-string (. (new BigInteger (str value)) (toString base)))
$endgroup$
Clojure, 109 bytes
Credit to MilkyWay90 for removing 10 bytes by spotting unnecessary spaces
Credit to Embodiment of Ignorance for another byte from another unnecessary space
Golfed
(defn f([b t](f b t 11))([b t v](if(= t 1)v(f b(dec t)(read-string(.(new BigInteger(str v))(toString b)))))))
Ungolfed
(defn f
([base term] (f base term 11))
([base term value] (if (= term 1)
value
(f base (dec term) (read-string (. (new BigInteger (str value)) (toString base)))))))
I think the main place bytes could be saved is the expression for... reradixing? whatever that would be called. Specifically:
(read-string (. (new BigInteger (str value)) (toString base)))
edited May 21 at 18:53
answered May 20 at 3:25
user70585user70585
1667 bronze badges
1667 bronze badges
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
There is still an unnecessary space in(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
add a comment |
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
There is still an unnecessary space in(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Do you need those spaces? Can you eliminate spaces?
$endgroup$
– MilkyWay90
May 20 at 14:32
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
Didn't even occur to me to remove spaces where they were separating syntactically differentiable things; looks like Clojure is a bit more permissive than I thought. Thank you!
$endgroup$
– user70585
May 20 at 17:50
$begingroup$
There is still an unnecessary space in
(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
There is still an unnecessary space in
(if (= t 1)
$endgroup$
– Embodiment of Ignorance
May 20 at 21:59
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
Whoop, good catch 👍
$endgroup$
– user70585
May 21 at 18:51
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
$begingroup$
93 bytes
$endgroup$
– Embodiment of Ignorance
May 22 at 3:01
add a comment |
$begingroup$
Perl 6, 28 bytes
{(11,+*.base($^b)...*)[$^t]}
Try it online!
The index into the sequence is zero-based.
$endgroup$
add a comment |
$begingroup$
Perl 6, 28 bytes
{(11,+*.base($^b)...*)[$^t]}
Try it online!
The index into the sequence is zero-based.
$endgroup$
add a comment |
$begingroup$
Perl 6, 28 bytes
{(11,+*.base($^b)...*)[$^t]}
Try it online!
The index into the sequence is zero-based.
$endgroup$
Perl 6, 28 bytes
{(11,+*.base($^b)...*)[$^t]}
Try it online!
The index into the sequence is zero-based.
answered May 20 at 6:20
SeanSean
4,0663 silver badges9 bronze badges
4,0663 silver badges9 bronze badges
add a comment |
add a comment |
$begingroup$
Jelly, 8 7 bytes
‘b³Ḍ$⁴¡
Try it online!
A full program that takes $b$ as first argument and 1-indexed $t$ as its second argument. Returns the integer for the relevant term (and implicitly prints). Uses the observation by @Emigna regarding starting with $b + 1$.
Explanation
‘b³Ḍ$⁴¡ | Main link: first argument b, second argument t
‘ | b + 1
$⁴¡ | Repeat the following t times
b³ | Convert to base b
Ḍ | Convert back from decimal to integer
$endgroup$
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
add a comment |
$begingroup$
Jelly, 8 7 bytes
‘b³Ḍ$⁴¡
Try it online!
A full program that takes $b$ as first argument and 1-indexed $t$ as its second argument. Returns the integer for the relevant term (and implicitly prints). Uses the observation by @Emigna regarding starting with $b + 1$.
Explanation
‘b³Ḍ$⁴¡ | Main link: first argument b, second argument t
‘ | b + 1
$⁴¡ | Repeat the following t times
b³ | Convert to base b
Ḍ | Convert back from decimal to integer
$endgroup$
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
add a comment |
$begingroup$
Jelly, 8 7 bytes
‘b³Ḍ$⁴¡
Try it online!
A full program that takes $b$ as first argument and 1-indexed $t$ as its second argument. Returns the integer for the relevant term (and implicitly prints). Uses the observation by @Emigna regarding starting with $b + 1$.
Explanation
‘b³Ḍ$⁴¡ | Main link: first argument b, second argument t
‘ | b + 1
$⁴¡ | Repeat the following t times
b³ | Convert to base b
Ḍ | Convert back from decimal to integer
$endgroup$
Jelly, 8 7 bytes
‘b³Ḍ$⁴¡
Try it online!
A full program that takes $b$ as first argument and 1-indexed $t$ as its second argument. Returns the integer for the relevant term (and implicitly prints). Uses the observation by @Emigna regarding starting with $b + 1$.
Explanation
‘b³Ḍ$⁴¡ | Main link: first argument b, second argument t
‘ | b + 1
$⁴¡ | Repeat the following t times
b³ | Convert to base b
Ḍ | Convert back from decimal to integer
edited May 20 at 6:44
answered May 19 at 23:22
Nick KennedyNick Kennedy
5,3199 silver badges14 bronze badges
5,3199 silver badges14 bronze badges
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
add a comment |
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Explanation for those of us who can't recognize atoms at a quick glance?
$endgroup$
– MilkyWay90
May 19 at 23:43
add a comment |
$begingroup$
K (ngn/k), 13 bytes
{y(10/x)/11}
Try it online!
$endgroup$
add a comment |
$begingroup$
K (ngn/k), 13 bytes
{y(10/x)/11}
Try it online!
$endgroup$
add a comment |
$begingroup$
K (ngn/k), 13 bytes
{y(10/x)/11}
Try it online!
$endgroup$
K (ngn/k), 13 bytes
{y(10/x)/11}
Try it online!
answered May 20 at 7:24
Galen IvanovGalen Ivanov
9,1521 gold badge14 silver badges39 bronze badges
9,1521 gold badge14 silver badges39 bronze badges
add a comment |
add a comment |
$begingroup$
Pyth, 8 bytes
uijGQTEh
Try it online!
$endgroup$
add a comment |
$begingroup$
Pyth, 8 bytes
uijGQTEh
Try it online!
$endgroup$
add a comment |
$begingroup$
Pyth, 8 bytes
uijGQTEh
Try it online!
$endgroup$
Pyth, 8 bytes
uijGQTEh
Try it online!
answered May 20 at 7:33
SokSok
4,76711 silver badges28 bronze badges
4,76711 silver badges28 bronze badges
add a comment |
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 87 bytes
n=>m=>{int g=11;for(var s="";m-->0;g=int.Parse(s),s="")for(;g>0;g/=n)s=g%n+s;return g;}
Saved 5 bytes thanks to @KevinCruijssen
Try it online!
$endgroup$
$begingroup$
87 bytes by changing thedo-while
into a regular for-loop.
$endgroup$
– Kevin Cruijssen
May 20 at 9:52
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 87 bytes
n=>m=>{int g=11;for(var s="";m-->0;g=int.Parse(s),s="")for(;g>0;g/=n)s=g%n+s;return g;}
Saved 5 bytes thanks to @KevinCruijssen
Try it online!
$endgroup$
$begingroup$
87 bytes by changing thedo-while
into a regular for-loop.
$endgroup$
– Kevin Cruijssen
May 20 at 9:52
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 87 bytes
n=>m=>{int g=11;for(var s="";m-->0;g=int.Parse(s),s="")for(;g>0;g/=n)s=g%n+s;return g;}
Saved 5 bytes thanks to @KevinCruijssen
Try it online!
$endgroup$
C# (Visual C# Interactive Compiler), 87 bytes
n=>m=>{int g=11;for(var s="";m-->0;g=int.Parse(s),s="")for(;g>0;g/=n)s=g%n+s;return g;}
Saved 5 bytes thanks to @KevinCruijssen
Try it online!
edited May 20 at 21:55
answered May 20 at 1:20
Embodiment of IgnoranceEmbodiment of Ignorance
4,5761 silver badge28 bronze badges
4,5761 silver badge28 bronze badges
$begingroup$
87 bytes by changing thedo-while
into a regular for-loop.
$endgroup$
– Kevin Cruijssen
May 20 at 9:52
add a comment |
$begingroup$
87 bytes by changing thedo-while
into a regular for-loop.
$endgroup$
– Kevin Cruijssen
May 20 at 9:52
$begingroup$
87 bytes by changing the
do-while
into a regular for-loop.$endgroup$
– Kevin Cruijssen
May 20 at 9:52
$begingroup$
87 bytes by changing the
do-while
into a regular for-loop.$endgroup$
– Kevin Cruijssen
May 20 at 9:52
add a comment |
$begingroup$
brainfuck, 270 bytes
++<<++<,+++<-[----->-<]<,,[<-----[->++++++++++<]++>[-<+>],]<[>>>>>>[<<<[->>+<<]>>>>>]<<[[>+<-]>>[-[<++++++++++>-]>+>]<[<<]>>[-<<+>>>+<]>>[-[<-[>>+>>]>>[+[-<<+>>]>[-<]<[>]>++>>>]<<<<<-]+>[-<+<+>>]<<[->>+<<]>>>]<[-]<[[-<+>]<<]<]<[->>+<<]<-]>>>>[>>]<<[>-[-----<+>]<----.<<]
Try it online!
0-indexed. The number of iterations is assumed to be at most 255.
Explanation
The tape is laid out as follows:
num_iterations 0 0 base digit0 0 digit1 0 digit2 ...
Each digit is actually stored as that digit plus 1, with 0 reserved for "no more digits". During the base conversion, the digits currently being worked on are moved one cell to the right, and the base is moved to the left of the current working area.
++<<++ Initialize initial value 11
<,+++<-[----->-<] Get single digit as base and subtract 48 to get actual number
<,,[<-----[->++++++++++<]++>[-<+>],] Read multiple digits as number of iterations
< Go to cell containing number of iterations
[ For each iteration:
>>>>>> Go to tens digit cell
[<<<[->>+<<]>>>>>] Move base to just before most significant digit
<< Return to most significant digit
[ For each digit in number starting at the left (right on tape):
[>+<-] Move digit one cell to right (to tell where current digit is later)
>>[-[<++++++++++>-]>+>] Multiply each other digit by 10 and move left
<[<<]>> Return to base
[-<<+>>>+<] Copy base to just before digit (again) and just before next digit to right (left on tape)
>>[ For each digit at least as significant as this digit:
-[<-[>>+>>]>>[+[-<<+>>] Compute "digit" divmod base
>[-<]<[>]>++ While computing this: add quotient to next digit; initialize digit to "1" (0) first if "0" (null)
>>>]<<<<<-] End of divmod routine
+>[-<+<+>>] Leave modulo as current digit and restore base
<<[->>+<<] Move base to next position
>>>
]
<[-]< Delete (now useless) copy of base
[[-<+>]<<]< Move digits back to original cells
] Repeat entire routine for each digit
<[->>+<<] Move base to original position
<- Decrement iteration count
]
>>>>[>>]<<[>-[-----<+>]<----.<<] Output by adding 47 to each cell containing a digit
$endgroup$
add a comment |
$begingroup$
brainfuck, 270 bytes
++<<++<,+++<-[----->-<]<,,[<-----[->++++++++++<]++>[-<+>],]<[>>>>>>[<<<[->>+<<]>>>>>]<<[[>+<-]>>[-[<++++++++++>-]>+>]<[<<]>>[-<<+>>>+<]>>[-[<-[>>+>>]>>[+[-<<+>>]>[-<]<[>]>++>>>]<<<<<-]+>[-<+<+>>]<<[->>+<<]>>>]<[-]<[[-<+>]<<]<]<[->>+<<]<-]>>>>[>>]<<[>-[-----<+>]<----.<<]
Try it online!
0-indexed. The number of iterations is assumed to be at most 255.
Explanation
The tape is laid out as follows:
num_iterations 0 0 base digit0 0 digit1 0 digit2 ...
Each digit is actually stored as that digit plus 1, with 0 reserved for "no more digits". During the base conversion, the digits currently being worked on are moved one cell to the right, and the base is moved to the left of the current working area.
++<<++ Initialize initial value 11
<,+++<-[----->-<] Get single digit as base and subtract 48 to get actual number
<,,[<-----[->++++++++++<]++>[-<+>],] Read multiple digits as number of iterations
< Go to cell containing number of iterations
[ For each iteration:
>>>>>> Go to tens digit cell
[<<<[->>+<<]>>>>>] Move base to just before most significant digit
<< Return to most significant digit
[ For each digit in number starting at the left (right on tape):
[>+<-] Move digit one cell to right (to tell where current digit is later)
>>[-[<++++++++++>-]>+>] Multiply each other digit by 10 and move left
<[<<]>> Return to base
[-<<+>>>+<] Copy base to just before digit (again) and just before next digit to right (left on tape)
>>[ For each digit at least as significant as this digit:
-[<-[>>+>>]>>[+[-<<+>>] Compute "digit" divmod base
>[-<]<[>]>++ While computing this: add quotient to next digit; initialize digit to "1" (0) first if "0" (null)
>>>]<<<<<-] End of divmod routine
+>[-<+<+>>] Leave modulo as current digit and restore base
<<[->>+<<] Move base to next position
>>>
]
<[-]< Delete (now useless) copy of base
[[-<+>]<<]< Move digits back to original cells
] Repeat entire routine for each digit
<[->>+<<] Move base to original position
<- Decrement iteration count
]
>>>>[>>]<<[>-[-----<+>]<----.<<] Output by adding 47 to each cell containing a digit
$endgroup$
add a comment |
$begingroup$
brainfuck, 270 bytes
++<<++<,+++<-[----->-<]<,,[<-----[->++++++++++<]++>[-<+>],]<[>>>>>>[<<<[->>+<<]>>>>>]<<[[>+<-]>>[-[<++++++++++>-]>+>]<[<<]>>[-<<+>>>+<]>>[-[<-[>>+>>]>>[+[-<<+>>]>[-<]<[>]>++>>>]<<<<<-]+>[-<+<+>>]<<[->>+<<]>>>]<[-]<[[-<+>]<<]<]<[->>+<<]<-]>>>>[>>]<<[>-[-----<+>]<----.<<]
Try it online!
0-indexed. The number of iterations is assumed to be at most 255.
Explanation
The tape is laid out as follows:
num_iterations 0 0 base digit0 0 digit1 0 digit2 ...
Each digit is actually stored as that digit plus 1, with 0 reserved for "no more digits". During the base conversion, the digits currently being worked on are moved one cell to the right, and the base is moved to the left of the current working area.
++<<++ Initialize initial value 11
<,+++<-[----->-<] Get single digit as base and subtract 48 to get actual number
<,,[<-----[->++++++++++<]++>[-<+>],] Read multiple digits as number of iterations
< Go to cell containing number of iterations
[ For each iteration:
>>>>>> Go to tens digit cell
[<<<[->>+<<]>>>>>] Move base to just before most significant digit
<< Return to most significant digit
[ For each digit in number starting at the left (right on tape):
[>+<-] Move digit one cell to right (to tell where current digit is later)
>>[-[<++++++++++>-]>+>] Multiply each other digit by 10 and move left
<[<<]>> Return to base
[-<<+>>>+<] Copy base to just before digit (again) and just before next digit to right (left on tape)
>>[ For each digit at least as significant as this digit:
-[<-[>>+>>]>>[+[-<<+>>] Compute "digit" divmod base
>[-<]<[>]>++ While computing this: add quotient to next digit; initialize digit to "1" (0) first if "0" (null)
>>>]<<<<<-] End of divmod routine
+>[-<+<+>>] Leave modulo as current digit and restore base
<<[->>+<<] Move base to next position
>>>
]
<[-]< Delete (now useless) copy of base
[[-<+>]<<]< Move digits back to original cells
] Repeat entire routine for each digit
<[->>+<<] Move base to original position
<- Decrement iteration count
]
>>>>[>>]<<[>-[-----<+>]<----.<<] Output by adding 47 to each cell containing a digit
$endgroup$
brainfuck, 270 bytes
++<<++<,+++<-[----->-<]<,,[<-----[->++++++++++<]++>[-<+>],]<[>>>>>>[<<<[->>+<<]>>>>>]<<[[>+<-]>>[-[<++++++++++>-]>+>]<[<<]>>[-<<+>>>+<]>>[-[<-[>>+>>]>>[+[-<<+>>]>[-<]<[>]>++>>>]<<<<<-]+>[-<+<+>>]<<[->>+<<]>>>]<[-]<[[-<+>]<<]<]<[->>+<<]<-]>>>>[>>]<<[>-[-----<+>]<----.<<]
Try it online!
0-indexed. The number of iterations is assumed to be at most 255.
Explanation
The tape is laid out as follows:
num_iterations 0 0 base digit0 0 digit1 0 digit2 ...
Each digit is actually stored as that digit plus 1, with 0 reserved for "no more digits". During the base conversion, the digits currently being worked on are moved one cell to the right, and the base is moved to the left of the current working area.
++<<++ Initialize initial value 11
<,+++<-[----->-<] Get single digit as base and subtract 48 to get actual number
<,,[<-----[->++++++++++<]++>[-<+>],] Read multiple digits as number of iterations
< Go to cell containing number of iterations
[ For each iteration:
>>>>>> Go to tens digit cell
[<<<[->>+<<]>>>>>] Move base to just before most significant digit
<< Return to most significant digit
[ For each digit in number starting at the left (right on tape):
[>+<-] Move digit one cell to right (to tell where current digit is later)
>>[-[<++++++++++>-]>+>] Multiply each other digit by 10 and move left
<[<<]>> Return to base
[-<<+>>>+<] Copy base to just before digit (again) and just before next digit to right (left on tape)
>>[ For each digit at least as significant as this digit:
-[<-[>>+>>]>>[+[-<<+>>] Compute "digit" divmod base
>[-<]<[>]>++ While computing this: add quotient to next digit; initialize digit to "1" (0) first if "0" (null)
>>>]<<<<<-] End of divmod routine
+>[-<+<+>>] Leave modulo as current digit and restore base
<<[->>+<<] Move base to next position
>>>
]
<[-]< Delete (now useless) copy of base
[[-<+>]<<]< Move digits back to original cells
] Repeat entire routine for each digit
<[->>+<<] Move base to original position
<- Decrement iteration count
]
>>>>[>>]<<[>-[-----<+>]<----.<<] Output by adding 47 to each cell containing a digit
edited May 22 at 16:21
answered May 22 at 14:59
NitrodonNitrodon
8,3062 gold badges10 silver badges26 bronze badges
8,3062 gold badges10 silver badges26 bronze badges
add a comment |
add a comment |
$begingroup$
Charcoal, 14 bytes
≔11ζFN≔⍘IζIηζζ
Try it online! Link is to verbose version of code. Takes inputs as $t$ (0-indexed) and $b$. Explanation:
≔11ζ
$x_0=11$.
FN
Loop $b$ times.
≔⍘IζIηζ
Calculate $x_i$.
ζ
Output $x_t$.
$endgroup$
add a comment |
$begingroup$
Charcoal, 14 bytes
≔11ζFN≔⍘IζIηζζ
Try it online! Link is to verbose version of code. Takes inputs as $t$ (0-indexed) and $b$. Explanation:
≔11ζ
$x_0=11$.
FN
Loop $b$ times.
≔⍘IζIηζ
Calculate $x_i$.
ζ
Output $x_t$.
$endgroup$
add a comment |
$begingroup$
Charcoal, 14 bytes
≔11ζFN≔⍘IζIηζζ
Try it online! Link is to verbose version of code. Takes inputs as $t$ (0-indexed) and $b$. Explanation:
≔11ζ
$x_0=11$.
FN
Loop $b$ times.
≔⍘IζIηζ
Calculate $x_i$.
ζ
Output $x_t$.
$endgroup$
Charcoal, 14 bytes
≔11ζFN≔⍘IζIηζζ
Try it online! Link is to verbose version of code. Takes inputs as $t$ (0-indexed) and $b$. Explanation:
≔11ζ
$x_0=11$.
FN
Loop $b$ times.
≔⍘IζIηζ
Calculate $x_i$.
ζ
Output $x_t$.
answered May 20 at 0:42
NeilNeil
86.7k8 gold badges46 silver badges183 bronze badges
86.7k8 gold badges46 silver badges183 bronze badges
add a comment |
add a comment |
$begingroup$
Pari/GP, 50 bytes
(b,n)->x=11;for(i=2,n,x=fromdigits(digits(x,b)));x
Try it online!
$endgroup$
add a comment |
$begingroup$
Pari/GP, 50 bytes
(b,n)->x=11;for(i=2,n,x=fromdigits(digits(x,b)));x
Try it online!
$endgroup$
add a comment |
$begingroup$
Pari/GP, 50 bytes
(b,n)->x=11;for(i=2,n,x=fromdigits(digits(x,b)));x
Try it online!
$endgroup$
Pari/GP, 50 bytes
(b,n)->x=11;for(i=2,n,x=fromdigits(digits(x,b)));x
Try it online!
answered May 20 at 4:12
alephalphaalephalpha
22.6k3 gold badges31 silver badges98 bronze badges
22.6k3 gold badges31 silver badges98 bronze badges
add a comment |
add a comment |
$begingroup$
C (gcc), 59 bytes
f(t,b){t=t?c(f(t-1,b),b):11;}c(n,b){n=n?c(n/b,b)*10+n%b:0;}
Try it online!
$endgroup$
add a comment |
$begingroup$
C (gcc), 59 bytes
f(t,b){t=t?c(f(t-1,b),b):11;}c(n,b){n=n?c(n/b,b)*10+n%b:0;}
Try it online!
$endgroup$
add a comment |
$begingroup$
C (gcc), 59 bytes
f(t,b){t=t?c(f(t-1,b),b):11;}c(n,b){n=n?c(n/b,b)*10+n%b:0;}
Try it online!
$endgroup$
C (gcc), 59 bytes
f(t,b){t=t?c(f(t-1,b),b):11;}c(n,b){n=n?c(n/b,b)*10+n%b:0;}
Try it online!
answered May 20 at 5:34
attinatattinat
1,7672 silver badges9 bronze badges
1,7672 silver badges9 bronze badges
add a comment |
add a comment |
$begingroup$
Groovy, 45 bytes
a,b,c=11->a--?f(a,b,a.toString(c as int,b)):c
Try it online!
Port of @Arnauld's answer
$endgroup$
add a comment |
$begingroup$
Groovy, 45 bytes
a,b,c=11->a--?f(a,b,a.toString(c as int,b)):c
Try it online!
Port of @Arnauld's answer
$endgroup$
add a comment |
$begingroup$
Groovy, 45 bytes
a,b,c=11->a--?f(a,b,a.toString(c as int,b)):c
Try it online!
Port of @Arnauld's answer
$endgroup$
Groovy, 45 bytes
a,b,c=11->a--?f(a,b,a.toString(c as int,b)):c
Try it online!
Port of @Arnauld's answer
answered May 20 at 8:56
Expired DataExpired Data
1,9704 silver badges23 bronze badges
1,9704 silver badges23 bronze badges
add a comment |
add a comment |
$begingroup$
PHP, 83 75 bytes
function c($b,$t,$v=11){return $t==1?$v:c($b,$t-1,base_convert($v,10,$b));}
Try it online!
This one will only work work with "small" numbers (e.g. not test cases 1 and 4)
$endgroup$
add a comment |
$begingroup$
PHP, 83 75 bytes
function c($b,$t,$v=11){return $t==1?$v:c($b,$t-1,base_convert($v,10,$b));}
Try it online!
This one will only work work with "small" numbers (e.g. not test cases 1 and 4)
$endgroup$
add a comment |
$begingroup$
PHP, 83 75 bytes
function c($b,$t,$v=11){return $t==1?$v:c($b,$t-1,base_convert($v,10,$b));}
Try it online!
This one will only work work with "small" numbers (e.g. not test cases 1 and 4)
$endgroup$
PHP, 83 75 bytes
function c($b,$t,$v=11){return $t==1?$v:c($b,$t-1,base_convert($v,10,$b));}
Try it online!
This one will only work work with "small" numbers (e.g. not test cases 1 and 4)
edited May 20 at 10:29
answered May 20 at 9:42
rollstuhlfahrerrollstuhlfahrer
1013 bronze badges
1013 bronze badges
add a comment |
add a comment |
$begingroup$
Japt, 10 bytes
0-indexed. Takes t
as the first input, b
as the second.
_ìV ì}gBìC
Try it
$endgroup$
add a comment |
$begingroup$
Japt, 10 bytes
0-indexed. Takes t
as the first input, b
as the second.
_ìV ì}gBìC
Try it
$endgroup$
add a comment |
$begingroup$
Japt, 10 bytes
0-indexed. Takes t
as the first input, b
as the second.
_ìV ì}gBìC
Try it
$endgroup$
Japt, 10 bytes
0-indexed. Takes t
as the first input, b
as the second.
_ìV ì}gBìC
Try it
answered May 20 at 18:31
ShaggyShaggy
20.7k3 gold badges20 silver badges69 bronze badges
20.7k3 gold badges20 silver badges69 bronze badges
add a comment |
add a comment |
$begingroup$
Gaia, 8 bytes
Bd
11@↑ₓ
Try it online!
Takes 0-based iterations
then base
.
Bd | helper function: convert to Base b (implicit) then convert to base 10
| main function:
11 | push 11
@ | push # of iterations
↑ₓ | do the above function (helper function) that many times as a monad
$endgroup$
add a comment |
$begingroup$
Gaia, 8 bytes
Bd
11@↑ₓ
Try it online!
Takes 0-based iterations
then base
.
Bd | helper function: convert to Base b (implicit) then convert to base 10
| main function:
11 | push 11
@ | push # of iterations
↑ₓ | do the above function (helper function) that many times as a monad
$endgroup$
add a comment |
$begingroup$
Gaia, 8 bytes
Bd
11@↑ₓ
Try it online!
Takes 0-based iterations
then base
.
Bd | helper function: convert to Base b (implicit) then convert to base 10
| main function:
11 | push 11
@ | push # of iterations
↑ₓ | do the above function (helper function) that many times as a monad
$endgroup$
Gaia, 8 bytes
Bd
11@↑ₓ
Try it online!
Takes 0-based iterations
then base
.
Bd | helper function: convert to Base b (implicit) then convert to base 10
| main function:
11 | push 11
@ | push # of iterations
↑ₓ | do the above function (helper function) that many times as a monad
edited May 20 at 19:11
answered May 20 at 18:56
GiuseppeGiuseppe
18.8k3 gold badges16 silver badges67 bronze badges
18.8k3 gold badges16 silver badges67 bronze badges
add a comment |
add a comment |
$begingroup$
Ruby, 39 bytes
Zero-indexed.
->b,n,x=11{n.times{x=x.to_s(b).to_i};x}
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 39 bytes
Zero-indexed.
->b,n,x=11{n.times{x=x.to_s(b).to_i};x}
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 39 bytes
Zero-indexed.
->b,n,x=11{n.times{x=x.to_s(b).to_i};x}
Try it online!
$endgroup$
Ruby, 39 bytes
Zero-indexed.
->b,n,x=11{n.times{x=x.to_s(b).to_i};x}
Try it online!
answered May 20 at 22:57
Value InkValue Ink
9,0157 silver badges33 bronze badges
9,0157 silver badges33 bronze badges
add a comment |
add a comment |
$begingroup$
Perl 5 -Mbigint -pa
, 65 bytes
$=11;map{$p=$;$%=0+"@F";$=($p%"@F").$while$p/=0+"@F"}2..<>}{
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -Mbigint -pa
, 65 bytes
$=11;map{$p=$;$%=0+"@F";$=($p%"@F").$while$p/=0+"@F"}2..<>}{
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -Mbigint -pa
, 65 bytes
$=11;map{$p=$;$%=0+"@F";$=($p%"@F").$while$p/=0+"@F"}2..<>}{
Try it online!
$endgroup$
Perl 5 -Mbigint -pa
, 65 bytes
$=11;map{$p=$;$%=0+"@F";$=($p%"@F").$while$p/=0+"@F"}2..<>}{
Try it online!
answered May 22 at 20:50
XcaliXcali
6,4651 gold badge6 silver badges23 bronze badges
6,4651 gold badge6 silver badges23 bronze badges
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f185816%2fto-exponential-digit-growth-and-beyond%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
Do we have to support larger numbers or just numbers up to 2^31 - 1?
$endgroup$
– Embodiment of Ignorance
May 19 at 23:39
1
$begingroup$
@EmbodimentofIgnorance The maximum of your language (Remember the standard loophole, though!)
$endgroup$
– MilkyWay90
May 19 at 23:43
$begingroup$
Is there a challenge that includes bases > 10? (In that case you would repeatedly interpret
11
as if it was in baseb
and convert it back to base 10, etc.)$endgroup$
– Neil
May 21 at 11:11
$begingroup$
@Neil I didn't include bases higher than 10 since (for example)
4a
wouldn't be a valid number in base-10$endgroup$
– MilkyWay90
May 22 at 22:49
$begingroup$
You wouldn't get
4a
, since you'd be interpreting the base 10 digits as baseb
and converting to base 10 each time (i.e. the other way around from this question).$endgroup$
– Neil
May 22 at 22:59