13
votes
Infinite Candle Sequence
Python, 31 bytes
f=lambda a:a and(f(a//2)+a%2)/2
Attempt This Online!
Returns the nth term (0-based) as a float.
Python, 54 bytes
a=b=0
while[print(int(bin(a)[:1:-1],2)/-~b)]:a+=1;b|=a
Attempt This ...
11
votes
8
votes
Palindromic Powers
05AB1E, 11 bytes
<TŸʒÓ¿≠yÂQ&
Try it online!
Before Kevin wakes up and outgolfs me. Port of Jelly.
How?
...
7
votes
The Binary Eyes
Python 3, 45 bytes
n=1
while[print(f'{0:1^{n}},{1:0^{n}}')]:n+=2
Try it online!
7
votes
Irradiated Polyglots
Perl 5 -M5.010 + A Pear Tree, score 0, tiebreak score 96 bytes
...
6
votes
The Binary Eyes
Python, 48 bytes
s,t="01"
while[print(s,t)]:s,t=f"1{s}1",f"0{t}0"
Attempt This Online!
-5 thanks to @loopy walt
JavaScript (V8), 42 bytes
...
6
votes
The Binary Eyes
Haskell, 31 bytes
g[0]
g x=x:map(0^)x:g(1:x++[1])
Try it online!
Infinite sequence
6
votes
Infinite Candle Sequence
JavaScript (ES6), 32 bytes
Returns the \$n\$-th term, 0-indexed.
f=(n,p=0)=>n?f(n>>1,2*p|n&1)/2:p
Try it online!
23 bytes
Using loopy walt's approach,...
6
votes
Palindromic Powers
Jelly, 13 bytes
’⁵rŒḂƇÆEg/’ƊƇ
Try it online!
-1 byte thanks to Jonathan Allan!
In order for some \$k = p_1^{e_1}p_2^{e_2}\cdots p_i^{e_i}\$ to be a perfect power (...
5
votes
Sequence of integers not the sum of powers of earlier terms
Python 3, 121 107 105 102 101 bytes
-3 inspired by Neil's comments, and another -1 thanks to Neil!
Prints the sequence indefinitely. Runs out of memory before finding 25 on TIO.
...
5
votes
Infinite Candle Sequence
Charcoal, 8 bytes
I↨·⁵↨⊗N²
Try it online! Link is to verbose version of code. Outputs the 0-indexed nth term. Explanation: ...
5
votes
Infinite Candle Sequence
C (gcc), 63 60 bytes
float d,v;float f(n){for(d=1,v=0;n;n/=2,d*=2)v+=v+n%2;v/=d;}
Try it online!
Saved 3 bytes thanks to Dominic van Essen!!!
Inputs integer \$n\$....
5
votes
Infinite Candle Sequence
Husk, 4 bytes
½B.ḋ
(or, equivalently, B.ḋD)
Try it online!
Outputs n-th term of sequence.
Same approach as Neil's variant of ...
5
votes
Infinite Candle Sequence
Jelly, 4 bytes
BHḅ.
A monadic Link that accepts a non-negative integer and yields the element of the binary Van der Corput sequence at that 0-indexed index.
Try it ...
5
votes
Find the nth Fibonacci number, where n is the mth Fibonacci number
Jelly, 4 bytes
ÆḞ2¡
Attempt This Online!
How?
ÆḞ2¡
2¡ # Execute twice:
ÆḞ # Nth fibonacci number
05AB1E, 4 bytes
...
4
votes
Infinite Candle Sequence
Factor, 54 42 bytes
[ >bin 48 v-n 0 [ [ 2 / ] bi@ + ] reduce ]
Try it online!
...
4
votes
Palindromic Powers
Wolfram Language (Mathematica), 60 bytes
Select[h=Range[#-1],(h[[a#]]=a=h[[#]])<#>9&&PalindromeQ@#&]&
Try it online!
...
4
votes
3
votes
The Binary Eyes
x86-64 machine code, 32 bytes
31 D2 B8 31 34 01 AA 34 01 89 D1 F3 AA F6 DC 78 F3 C6 07 0A AE 7B F0 FF C2 39 F2 75 EA 88 0F C3
Try it online!
Following the standard ...
3
votes
3
votes
The Binary Eyes
Jelly, 6 bytes
ṬŒḄ¬Ƭ)
Try it online!
Add another byte if the pairs can't be backwards.
3
votes
3
votes
Sequence of integers not the sum of powers of earlier terms
Jelly, 24 22 bytes
*þṀŻ$ZŒpŒP€Ẏ§‘ḟ$Ṃ;
⁸Ç¡
Try it online!
Takes \$n\$ via STDIN and outputs the first \$n\$ terms in reverse order. +1 byte if the output has to be ...
3
votes
Sequence of integers not the sum of powers of earlier terms
Jelly, 22 bytes
-rṀṗL‘a*@ɗ⁸§‘ḟ$Ṃ;@
⁸Ç¡
A full program that accepts an integer, n, from STDIN and prints the Jelly ...
3
votes
Infinite Candle Sequence
Retina 0.8.2, 64 bytes
\d+
$*
+`(1+)\1
$+0
01
1
.+
$&/$.&$*01
1
10
+`01
110
0
1+|^
$.&
Try it online! Link is to test suite that generates the results ...
3
votes
Infinite Candle Sequence
PARI/GP, 23 bytes
f(a)=if(a,f(a\2)+a%2)/2
Attempt This Online!
A port of loopy walt's Python answer.
3
votes
Infinite Candle Sequence
Wolfram Language (Mathematica), 38 33 bytes
If[#<1,0,#0@⌊#/2⌋+#~Mod~2]/2&
Try it online!
-5 bytes thanks to att
3
votes
Palindromic Powers
Vyxal, 14 bytes
‹₀ṡ'ǐĠvLġċnḂ=∧
Try it Online!
Port of Jelly answer.
How?
...
3
votes
Palindromic Powers
C (gcc), 117 bytes
Brute force at its finest. It might be improvable by merging the two for loops into one, but I currently have no idea how to go about that.
<...
3
votes
Palindromic Powers
Haskell, 76 72 64 bytes
f n=[z|x<-[2..n],z<-map(x^)[2..n],z<n,(==)=<<reverse$show z,z>9]
Attempt This Online!
Given the ranges ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sequence × 837code-golf × 771
number × 229
math × 207
number-theory × 106
integer × 81
combinatorics × 65
primes × 63
arithmetic × 59
fibonacci × 44
binary × 35
string × 34
subsequence × 30
code-challenge × 28
cops-and-robbers × 28
decision-problem × 26
base-conversion × 25
kolmogorov-complexity × 20
array × 19
geometry × 17
fastest-code × 17
permutations × 16
grid × 14
palindrome × 12
ascii-art × 10