Added logorithmic generator.

This commit is contained in:
Cédric Bonhomme 2012-12-14 11:45:13 +01:00
parent 409da738dd
commit a22605f5fe

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Stéganô - Stéganô is a basic Python Steganography module.
# Copyright (C) 2010-2011 Cédric Bonhomme - http://cedricbonhomme.org/
# Copyright (C) 2010-2011-2012 Cédric Bonhomme - http://cedricbonhomme.org/
#
# For more information : http://bitbucket.org/cedricbonhomme/stegano/
#
@ -20,10 +20,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__version__ = "$Revision: 0.2 $"
__date__ = "$Date: 2011/12/28 $"
__revision__ = "$Date: 2012/12/14 $"
__license__ = "GPLv3"
import math
import itertools
def identity():
@ -136,9 +138,18 @@ def syracuse(l=15):
else:
y = 3*y + 1
def log_gen():
"""
Logarithmic generator.
"""
y = 1
while True:
adder = max(1, math.pow(10, int(math.log10(y))))
yield int(y)
y = y + adder
if __name__ == "__main__":
# Point of entry in execution mode.
f = fibonacci()
for x in range(13):
print f.next(), # 0 1 1 2 3 5 8 13 21 34 55 89 144
print f.next(), # 0 1 1 2 3 5 8 13 21 34 55 89 144