Click here to Skip to main content
15,893,381 members

Ilka Guigova - Professional Profile



Summary

    Blog RSS
3,733
Author
60
Authority
328
Debator
193
Editor
5
Enquirer
346
Organiser
888
Participant

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
GeneralInvoking a Generic Method With Parameters using Reflection Pin
Ilka Guigova28-Aug-11 13:35
Ilka Guigova28-Aug-11 13:35 
GeneralRe: Invoking a Generic Method With Parameters using Reflection Pin
Ilka Guigova1-Mar-12 7:25
Ilka Guigova1-Mar-12 7:25 
GeneralSlide-In Image Captions Pin
Ilka Guigova27-Aug-11 19:49
Ilka Guigova27-Aug-11 19:49 
General30 Useful jQuery Tabs Tutorials Pin
Ilka Guigova9-Jul-11 14:36
Ilka Guigova9-Jul-11 14:36 
GeneralOne-liners Pin
Ilka Guigova4-Jun-12 7:34
Ilka Guigova4-Jun-12 7:34 
GeneralLogical XOR in Javascript Pin
Ilka Guigova25-Apr-11 14:36
Ilka Guigova25-Apr-11 14:36 
GeneralA Collapsible Outline of Indented Text in Javascript Pin
Ilka Guigova6-Feb-11 16:19
Ilka Guigova6-Feb-11 16:19 
GeneralPython calculations - arrangements Pin
Ilka Guigova30-Aug-10 7:44
Ilka Guigova30-Aug-10 7:44 
Crack-free walls (Project Euler):
Consider the problem of building a wall out of 2 x 1 and 3 x 1 bricks (horizontal x vertical dimensions) such that, for extra strength, the gaps between horizontally-adjacent bricks never line up in consecutive layers, i.e. never form a "running crack".

There are eight ways of forming a crack-free 9 x 3 wall, written W(9,3) = 8.

Calculate W(32,10).

Let
L = length of the row
k = the number of 2 x 1 blocks in a row
l = the number of 3 x 1 blocks in a row
A(k, l) = (k + l)! / k!l! = the number of arrangements of k 2 x 1 blocks and l 3 x 1 blocks

Then
(1) The number of rows of length L is:
R = \forall (k, l) \sum A(k, l)\mid 2*k + 3*l = L


(2) Cracks can occur at positions p in [2, L - 2]. The number of cracks between two rows of length L is:
C = \forall (k, l) \forall p \forall (m, n) \sum (A(k, l)*A(k-m, l-n) \mid 2*k + 3*l = L, p\in [2, L - 2], 2*m + 3*n = p, k - m >= 0, l - n >= 0


(3) The number of ways of forming a crack-free L x 2 wall is:
W(L, 2) = R*R - R - C = R*(R - 1) - C, (i.e., there are R*R walls, R walls with duplicate rows, C walls with cracks)

(4) In order to calculate the number of walls of any height it is enough to know the pattern of increase of cracks with the increase of height.

Observations (in progress):

Let
Wi = the number of walls of height i
Si = the number of splits at height i
s = the number of splits of a row

Then
Wi+1 = Wi + Si
Rows with s = 0 do not contribute to the pattern and can be ignored
Rows with s = 1 do not contribute to the pattern and their count can be carried as a constant

L = 9, W(9, 1) = {333, 3222, 2322, 2232, 2223} = 5
      | 2 | 3 | 4 | 5 | 6 | 7  position
------------------------------------------------------
  333 |   | x |   |   | x |   | 2 
 3222 |   | x |   | x |   | x | 1
 2322 | x |   |   | x |   | x | 1
 2232 | x |   | x |   |   | x | 1
 2223 | x |   | x |   | x |   | 1
-------------------------------------------------------
      | 3 | 2 | 2 | 2 | 2 | 3  number of cracks
 
1 | 2 |  3 |  4 |  5 |  6 |  7  wall height
-------------------------------------------------------
5 | 6 |  8 | 10 | 14 | 18 | 24  number of crack-free walls, W
  | 1 |  2 |  2 |  4 |  4 |  8  number of splits, S
  | 0 |  1 |  1 |  2 |  2 |  4  number of splits / 2
  
Graph of row relationships:

  | 2322 |(1) -- |  333 |(2) -- | 2232 | (1)
  
  | 3222 |(1) -- | 2223 |(1) 
  
Graph of significant row relationships: 

  |  333 |  

L = 10, W(10, 1) = {2332, 22222, 2233, 2323, 3223, 3232, 3322} = 7
      | 2 | 3 | 4 | 5 | 6 | 7 | 8  position
------------------------------------------------------
 2332 | x |   |   | x |   |   | x | 0 
22222 | x |   | x |   | x |   | x | 1
 2233 | x |   | x |   |   | x |   | 2
 2323 | x |   |   | x |   | x |   | 1
 3223 |   | x |   | x |   | x |   | 1
 3232 |   | x |   | x |   |   | x | 1
 3322 |   | x |   |   | x |   | x | 2
-------------------------------------------------------
      | 4 | 3 | 2 | 4 | 2 | 3 | 4  number of cracks
 
1 | 2 |  3 |  4 |  5 |  6   wall height
-------------------------------------------------------
7 | 8 | 12 | 18 | 28 | 44	number of crack-free walls, W
  | 2 |  4 |  6 | 10 | 16   number of splits, S
  | 1 |  2 |  3 |  5 |  8	number of splits / 2
  
Graph of row relationships:

  |  2332 |(0) 
  
  |  3223 |(1) -- | 22222 |(1) 
  
  |  3322 |(2) -- |  2233 |(2)      
      |                | 	  
  |  2323 |(1)    |  3232 |(1)
  
Graph of significant row relationships: 

  |  3322 | -- |  2233 |  

L = 11, W(11, 1) = {22223, 22232, 22322, 23222, 32222, 2333, 3233, 3323, 3332} = 9
      | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  position
------------------------------------------------------
22223 | x |   | x |   | x |   | x |   | 1 
22232 | x |   | x |   | x |   |   | x | 1
22322 | x |   | x |   |   | x |   | x | 2
23222 | x |   |   | x |   | x |   | x | 1
32222 |   | x |   | x |   | x |   | x | 1
 2333 | x |   |   | x |   |   | x |   | 1
 3233 |   | x |   | x |   |   | x |   | 2
 3323 |   | x |   |   | x |   | x |   | 2
 3332 |   | x |   |   | x |   |   | x | 1
-------------------------------------------------------
      | 5 | 4 | 3 | 4 | 4 | 3 | 4 | 5  number of cracks

1 | 2  |  3 |  4 |  5 |  6  wall height
-------------------------------------------------------
9 | 12 | 18 | 28 |    |     number of crack-free walls, W
  |  3 |  6 | 10 |    |     number of splits, S
  |  1 |  3 |  5 |    |     number of splits / 2
  
Graph of row relationships:

  |  22223 |(1) -- | 32222 |(1) 
  
  |   2333 |(1) -- |  3332 |(1) 
  
  |   3323 |(2) -- | 22322 |(2) -- |  3233 |(2)
       |                                | 
  |  23222 |(1)                    | 22232 |(1)
  
Graph of significant row relationships: 

  |  3323 | -- |  22322 | -- |  3233 | 


Calculations:
Python
  1  import math
  2  
  3  def get_factors(length):
  4  	#NOTE: 10x slower <-> return [(x, y) for x in range(length) for y in range(length) if get_length(x, y) == length]
  5  	factors = [(length/2 - length%2, length%2)]
  6  	while factors[0][0] >= 3:
  7  		factors[0:0] = (factors[0][0] - 3, factors[0][1] + 2),
  8  	return factors	
  9  	
 10  def count_arrangements(x, y): 
 11  	return math.factorial(x + y) / (math.factorial(x) * math.factorial(y))
 12  	
 13  def count_rows(rows): 
 14  	#return reduce(lambda x, y: x + y, [count_arrangements(row[0], row[1]) for row in rows])
 15  	return sum([count_arrangements(row[0], row[1]) for row in rows])
 16  
 17  def count_cracks(length, rows): 
 18  	return sum([count_arrangements(cracks[0], cracks[1])*count_arrangements(row[0]-cracks[0], row[1]-cracks[1]) for row in rows for c in range(2, length - 1) for cracks in get_factors(c) if row[0] - cracks[0] >= 0 if row[1] - cracks[1] >= 0])
 19  	
 20  #-----------------------	
 21  #3329
 22  def get_rows(length, rows = [[0]]):
 23  	if (length > 1):
 24  		if (len(rows[0]) < length): 
 25  			r = [row + [1] for row in rows if ((row[-2:] == [0, 0]) or (row[-2:] == [1, 0]) or (row[-2:] == [0]))]
 26  			
 27  			if (len(rows[0]) < length - 1):		
 28  				r.extend([row + [0] for row in rows if ((row[-1:] == [1]) or (row[-2:] == [1, 0]) or (row[-2:] == [0]))])
 29  			
 30  			return get_rows(length, r)
 31  		else:
 32  			return rows
 33  	return []
 34  			
 35  #33791			
 36  def count_splits(rows): 
 37  	return sum([len(filter(lambda z: z == 1, [count_cracked(row1, row2) for row2 in rows])) - 1 for row1 in rows])
 38  	
 39  def count_cracked(row1, row2): 
 40  	if len(row1) == len(row2): 
 41  		return len(filter(lambda z: z > 1, map(lambda x, y: x + y, row1, row2)))
 42  			
 43  #-----------------------			
 44  def count_walls(length, height):
 45  	pass
 46  	
 47  #-----------------------	
 48  def get_time(fcall, i): 
 49  	import timeit
 50  	t = timeit.Timer("e205_07.%s" % fcall, "import e205_07")
 51  	print "%s, %d calls/batch" % (t.repeat(3, i), i)	
 52  
 53  	
 54  if __name__=='__main__':	
 55  	#get_time("count_walls(32, 2)", 1)
 56  	#get_time("get_rows(32)", 1)


modified on Tuesday, August 31, 2010 3:35 PM

GeneralVisualStudio 2005 Slow On Save Pin
Ilka Guigova23-May-10 13:44
Ilka Guigova23-May-10 13:44 
GeneralT-SQL Cursor and XML Basic Example Pin
Ilka Guigova3-Apr-10 13:13
Ilka Guigova3-Apr-10 13:13 
GeneralT-SQL Auto Increment Variable Pin
Ilka Guigova2-Apr-10 20:04
Ilka Guigova2-Apr-10 20:04 
GeneralApplying XSL Transformations Pin
Ilka Guigova29-Mar-10 11:05
Ilka Guigova29-Mar-10 11:05 
GeneralXML DOM Load Functions Pin
Ilka Guigova10-Aug-12 13:46
Ilka Guigova10-Aug-12 13:46 
GeneralWorking with durations in MSSQL server Pin
Ilka Guigova31-Jan-10 13:11
Ilka Guigova31-Jan-10 13:11 
GeneralRe: Working with durations in MSSQL server Pin
Grunge Boy31-Jan-10 23:29
Grunge Boy31-Jan-10 23:29 
GeneralRe: Working with durations in MSSQL server Pin
Ilka Guigova1-Feb-10 7:17
Ilka Guigova1-Feb-10 7:17 
GeneralThe hidden __arglist keyword Pin
Ilka Guigova9-Aug-09 14:38
Ilka Guigova9-Aug-09 14:38 
GeneralServices Pin
Ilka Guigova9-Aug-09 14:27
Ilka Guigova9-Aug-09 14:27 
GeneralTerminal Services Pin
Ilka Guigova9-Aug-09 14:24
Ilka Guigova9-Aug-09 14:24 
GeneralSerial com ports Pin
Ilka Guigova9-Aug-09 14:18
Ilka Guigova9-Aug-09 14:18 
GeneralScrollable GridView Pin
Ilka Guigova9-Aug-09 13:58
Ilka Guigova9-Aug-09 13:58 
GeneralHow to instantiate a class from a class name Pin
Ilka Guigova9-Aug-09 11:08
Ilka Guigova9-Aug-09 11:08 
GeneralDebugging COM+ Components in Visual Studio Pin
Ilka Guigova9-Aug-09 10:41
Ilka Guigova9-Aug-09 10:41 
GeneralRetrieving the COM+ class factory for component failed Pin
Ilka Guigova29-Jul-10 12:10
Ilka Guigova29-Jul-10 12:10 
GeneralDebugging COM+ Components in Delphi Pin
Ilka Guigova9-Aug-09 9:27
Ilka Guigova9-Aug-09 9:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.