OFFSET
1,1
LINKS
T. D. Noe and Ivan Neretin, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
Robert Baillie, Summing the curious series of Kempner and Irwin, arXiv:0806.4410 [math.CA], 2008-2015. See p. 18 for Mathematica code irwinSums.m.
FORMULA
a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
a(n) = 2^A194882(n-1) + 2^A194883(n-1) + 2^A194884(n-1) + 2^A127324(n-1). - Ridouane Oudra, Sep 06 2020
Sum_{n>=1} 1/a(n) = 1.399770961748474333075618147113153558623203796657745865012742162098738541849... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022
MATHEMATICA
Select[ Range[ 180 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==4)& ] (* Olivier Gérard *)
PROG
(Perl) $N = 4;
my $vector = 2 ** $N - 1; # first key (15)
for (1..100) {
print "$vector, ";
my ($v, $d) = ($vector, 0);
until ($v & 1 or !$v) { $d = ($d << 1)|1; $v >>= 1 }
$vector += $d + 1 + (($v ^ ($v + 1)) >> 2); # next key
} # Ruud H.G. van Tol, Mar 02 2014
(PARI) for(n=0, 10^3, if(hammingweight(n)==4, print1(n, ", "))); \\ Joerg Arndt, Mar 04 2014
(PARI) print1(t=15); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
(Python)
A014312_list = [2**a+2**b+2**c+2**d for a in range(3, 6) for b in range(2, a) for c in range(1, b) for d in range(c)] # Chai Wah Wu, Jan 24 2021
(Rust)
pub const fn next_choice(value: usize) -> usize {
// Passing a term will return the next number in the sequence
let zeros = value.trailing_zeros();
let ones = (value >> zeros).trailing_ones();
value + (1 << zeros) + (1 << (ones - 1)) - 1
} // Andrew Bennett, Jan 07 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Al Black (gblack(AT)nol.net)
EXTENSIONS
Extension by Olivier Gérard
STATUS
approved