6 kyu

# Counting 1: I Want Some Subsets, Not All!

182 of 307raulbc777

Description:

We have a set of consecutive numbers from 1 to n. We want to count all the subsets that do not contain consecutive numbers. E.g.

If our set S1 is equal to [1,2,3,4,5] The subsets that fulfill these property are:

[1],[2],[3],[4],[5],[1,3],[1,4],[1,5],[2,4],[2,5],[3,5],[1,3,5]

A total of 12 subsets.

From the set S2 equals to[1,2,3], it is obvious that we have only 4 subsets and are:

[1],[2],[3],[1,3]

Make a code that may give the amount of all these subsets for any integer n >= 2 .

Features of the random tests:

number of tests = 100 
10 <= n <= 120
Number Theory
Fundamentals

Stats:

CreatedMay 10, 2017
PublishedMay 10, 2017
Warriors Trained1715
Total Skips124
Total Code Submissions1429
Total Times Completed307
Python Completions182
JavaScript Completions78
Ruby Completions25
Haskell Completions16
C# Completions24
Java Completions28
Scala Completions7
Total Stars35
% of votes with a positive feedback rating89% of 82
Total "Very Satisfied" Votes67
Total "Somewhat Satisfied" Votes12
Total "Not Satisfied" Votes3
Total Rank Assessments5
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • raulbc777 Avatar
  • Voile Avatar
  • user9644768 Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • macambira Avatar
  • BobtheLantern Avatar
  • dfhwze Avatar
  • Just4FunCoder Avatar
  • KayleighWasTaken Avatar
Ad